urlthread-safetythree20

Is Three20Network thread safe?


Is Three20Network thread safe. i.e can I send multiple requests to the Three20Network framework simultaneously from different threads?

When I send the request for SAME URL from different threads simultaneously, I was not getting any callback. When I tried to traced out the problem I observed that I get timeout error though network connection was proper. What is the problem here?


Solution

  • TTURLRequest is not thread safe. It's possible that the network queue will get paused on the main thread, then resume on a background thread. If you have any ui code in your delegates this will crash the app (as the ui should only be updated on the main thread). Therefore you should only use these classes on the main thread. If you need to do background operations, just use the apple NSURLRequest classes.