> Now I thought it would be interesting to try those calls before the thread 
> was dispatched, and the terminate one worked, but the run loop stop didn't. I 
> also tried the runloop stop one in my mini test application, and it didn't 
> work there either, so am a bit suspicious of that. Should that kill any 
> application?

No, it shouldn't make your app terminate - it'll just cause
CFRunLoopRunInMode() to return (see the stack trace you posted
earlier.) I was thinking this would cause the
-performSelectorOnMainThread machinery to notice that there was an
enqueued invocation. (Not that this should be necessary, of course.)

On my system, -performSelectorOnMainThread works using a
CFRunLoopSource attached to the main thread's run loop, which is
signaled after -performSelectorOnMainThread has enqueued an object
representing the invocation. I'm thinking -performSelectorOnMainThread
isn't working because either the main thread isn't running in a common
mode, or something's failing with the CFRunLoopSource. Here are some
things to try:

1. Place a breakpoint on the line after the call to
-performSelectorOnMainThread. After this is hit, at the GDB prompt,
enter the following command:

    po (void*)CFRunLoopGetMain()

This should print a lot of information. One of the first lines printed
will mention "current mode =". What mode does it say?

2. In the information printed in the last step, do you see a run loop
source mentioned with a callout of "__NSThreadPerformPerform"? (This
is the run loop source mentioned previously.)

3. Stop your program, and set a breakpoint on the
-performSelectorOnMainThread line. Run your program again. When this
breakpoint is hit, before continuing your program, set a breakpoint at
CFRunLoopSourceSignal(). Continue your program. The
CFRunLoopSourceSignal breakpoint should be hit (directly or
indirectly) from within the stack frame of
-performSelectorOnMainThread; is this true?
_______________________________________________

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

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

Reply via email to