Can I share a single ACAccount
instance between threads? Specifically I would like to create multiple TWRequest
objects that are used by different NSOperationQueue
instances. Those TWRequest
objects will share a single ACAccount
instance. Is that safe?
Thanks.
I'm going to say, "no." Firstly, ACAccount
does not appear on Apple's "Thread Safe" list. Secondly, I see no explicit mention of thread safety in the reference for either of those classes. Thirdly, I see that TWRequest appears to be built upon NSURLConnection
which is designed for use on a run loop (typically the main thread). I see nothing at all to indicate that these classes are safe for concurrent use from multiple threads. At best, you should take a thread-confinement approach (i.e. each thread fetches/creates its own copies of these objects and should not pass them between threads.)
Since TWRequest is designed for cooperative/runloop-based operation, I see no reason that you would need to do this stuff on a background thread either, FWIW.
So yeah. I'd say, "no."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With