• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Thread deadlock?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Thread deadlock? (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: Memory Leaks & Instruments Questions
  • Next by Date: Re: NSImage and zooming PDFs vs. bitmaps
  • Previous by thread: Thread deadlock?
  • Next by thread: Re: Thread deadlock?
  • Index(es):
    • Date
    • Thread