Re: Thread deadlock?
Re: Thread deadlock?
- Subject: Re: Thread deadlock?
- From: "Michael Ash" <email@hidden>
- Date: Mon, 11 Aug 2008 12:52:08 -0400
On Mon, Aug 11, 2008 at 8:09 AM, Trygve Inda <email@hidden> wrote:
> I am seeing a deadlock I think... It works in the debugger, but hangs when
> running alone. The killThread is called as part of the
> applicationWillTerminate delegate method.
You can use gdb to attach to the program after it freezes to find out
where it's stuck. Or just use Shark, or sample in Activity Monitor.
> if ([lock lockWhenCondition:kConditionThreadMustExit)
How does this even compile? The braces are unbalanced, and
lockWhenCondition: returns void.
In any case, you definitely have deadlock potential here. Your
-killThread method blocks waiting for the thread to exit. Your thread
blocks waiting for the main thread to complete. If both of these
happen at the same time, both of them are waiting for the other to
finish first.
Mike
_______________________________________________
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