Re: Thread synchronization via queue
Re: Thread synchronization via queue
- Subject: Re: Thread synchronization via queue
- From: Kyle Sluder <email@hidden>
- Date: Thu, 17 Jan 2013 08:22:43 -0800
On Jan 17, 2013, at 2:09 AM, Charles Srstka <email@hidden> wrote:
> You could start a run loop in a dispatch queue, schedule the NSInputStream on that runloop, and then have the delegate methods block/unblock your reading thread via a lock/semaphore/etc.
Do not start a runloop in a block submitted to a dispatch queue. You do not own the thread that your block is executing on, therefore you should not mutate thread state. For all you know, if you dispatch_async from a background thread, your block will execute on the main thread.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden