On Jan 5, 2014, at 4:37 PM, Jim O'Connor <jocon...@orderndev.com> wrote:

> When my read stream finishes I schedule a timer to clean up on the runloop to 
> serialize access to shared resources.
> However, I had a hang late last night because a mutex grabbed in the read 
> stream callback handler was held and was also being grabbed when the timer it 
> scheduled to clean up fired INSIDE the callback.

If your stream and timer are scheduled on the same runloop, they’ll never run 
on different threads.
However, it’s possible for a runloop to run re-entrantly — that is, if you call 
something that blocks and runs the runloop, your callback (a timer or whatever) 
might get invoked inside there. So you might get a stack like
        runloop —> my stream callback —> some system API —> runloop —> my timer 
callback
Make sure to save the stack next time this happens.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to