cancel method uses background thread (returned by threadForRequest), but synchronous thread executed in other thread. When we cancel synchronous request we sometimes get a bad access crash.
NSZombie print: *\ -[CFWriteStream hasSpaceAvailable]: message sent to deallocated instance 0x35ef5020
Other issue: Do we need @synchronized() in threadForRequest ? We can lunch request from multiple threads.
This issue relative to code in ASIHTTPRequest:
pragma mark threading behaviour
// In the default implementation, all requests run in a single background thread
// Advanced users only: Override this method in a subclass for a different threading behaviour
// Eg: return [NSThread mainThread] to run all requests in the main thread
// Alternatively, you can create a thread on demand, or manage a pool of threads
// Threads returned by this method will need to run the runloop in default mode (eg CFRunLoopRun())
// Requests will stop the runloop when they complete
// If you have multiple requests sharing the thread or you want to re-use the thread, you'll need to restart the runloop
cancel method uses background thread (returned by threadForRequest), but synchronous thread executed in other thread. When we cancel synchronous request we sometimes get a bad access crash.
NSZombie print: *\ -[CFWriteStream hasSpaceAvailable]: message sent to deallocated instance 0x35ef5020
Other issue: Do we need @synchronized() in threadForRequest ? We can lunch request from multiple threads. This issue relative to code in ASIHTTPRequest:
pragma mark threading behaviour
// In the default implementation, all requests run in a single background thread // Advanced users only: Override this method in a subclass for a different threading behaviour // Eg: return [NSThread mainThread] to run all requests in the main thread // Alternatively, you can create a thread on demand, or manage a pool of threads // Threads returned by this method will need to run the runloop in default mode (eg CFRunLoopRun()) // Requests will stop the runloop when they complete // If you have multiple requests sharing the thread or you want to re-use the thread, you'll need to restart the runloop
…….
}