How can main thread be blocked in mach_msg_trap?
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