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,
ACAccountdoes 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 uponNSURLConnectionwhich 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.”