Re: using select() without blocking the runloop
Don’t use dispatch queues for long blocking operations. It messes up libDispatch’s scheduling. For a task like this, you should explicitly create a thread using either NSThread or pthreads. (Also, there’s almost never a need to use select() in Cocoa code. Is there a reason you can’t use any higher level network code like CFStream, NSStream, or NSURLSession?)
The likely problem here is that several of these parameters are pointers, and the buffers they point to may no longer be valid by the future time that the block runs … especially if they’re local variables of the enclosing function/method/ —Jens |
|