• 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
How can main thread be blocked in mach_msg_trap?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can main thread be blocked in mach_msg_trap?


  • Subject: How can main thread be blocked in mach_msg_trap?
  • From: Jerry Krinock <email@hidden>
  • Date: Sat, 21 Mar 2009 20:54:26 -0700


NSLogs tell me that, when one of my secondary threads executes a performSelectorOnMainThread::: at a certain point, the requested method never begins. So I conclude that the main thread ^is^ blocked.


But if I "Pause" the debugger at this point and examine the call stack for "Thread-1", I see:

#0	0x9540b1c6 in mach_msg_trap
#1	0x954129bc in mach_msg
#2	0x9495f0ae in CFRunLoopRunSpecific
#3	0x9495fcd8 in CFRunLoopRunInMode
#4	0x929ced75 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
#5	0x929dae94 in -[NSRunLoop(NSRunLoop) run]
#6	0x00002a3f in main at Worker-Main.m:112

I always thought that mach_msg_trap means that a thread is sitting at the top of a run loop waiting for an input source, such as performSelectorOnMainThread:::, to wake it. Therefore it is ^not^ blocked.

My understanding thus ends in a paradox.  How can this be explained?

(Notice that this is a background agent in which I have explicitly invoked -[NSRunLoop run])

Thank you,

Jerry Krinock


_______________________________________________

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


  • Follow-Ups:
    • Re: How can main thread be blocked in mach_msg_trap?
      • From: Michael Ash <email@hidden>
    • Re: How can main thread be blocked in mach_msg_trap?
      • From: Eric Schlegel <email@hidden>
  • Prev by Date: Re: nstableview **very** basic question
  • Next by Date: Explicit release when using garbage collection with circular references
  • Previous by thread: Re: NSString and Leaks Instrument, False Positives?
  • Next by thread: Re: How can main thread be blocked in mach_msg_trap?
  • Index(es):
    • Date
    • Thread