Re: performSelectorOnMainThread fails second time through
Re: performSelectorOnMainThread fails second time through
- Subject: Re: performSelectorOnMainThread fails second time through
- From: Gideon King <email@hidden>
- Date: Wed, 8 Dec 2010 17:23:04 +1000
Thanks for those excellent suggestions Dave (way above my head, but it's good to have the instructions to execute).
1. Current mode is kCFRunLoopDefaultMode
2. Nothing beginning with NSThread (same was true of my mini test app)
3. Yes, it broke at both those points, and there was something odd going on with the wake up - it says current mode is (none). It tried this on the mini test application, and it gave a mode of kCFRunLoopDefaultMode. So it looks as if we're getting somewhere in tracking down that there seems to be something wrong with the program at that point, but I really don't fully understand what it means or where to go next.
#0 0x92154965 in CFRunLoopSourceSignal ()
#1 0x996c27c1 in -[NSThread _nq:] ()
#2 0x996c243d in -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] ()
#3 0x996d4adf in -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] ()
#4 0x00057a6c in -[AALayoutExecutor innerExecute:] (self=0x1a15ee0, _cmd=0x7fe3f, data=0x1e03c30) at /Users/gideon/Development/Restored/CADisplay/AALayoutExecutor.m:133
#5 0x000572ca in -[AALayoutExecutor doLayout:] (self=0x1a15ee0, _cmd=0x7fe50, data=0x1e03c30) at /Users/gideon/Development/Restored/CADisplay/AALayoutExecutor.m:50
#6 0x996acbf0 in -[NSThread main] ()
#7 0x996acba0 in __NSThread__main__ ()
#8 0x9549885d in _pthread_start ()
#9 0x954986e2 in thread_start ()
<CFRunLoopSource 0x180a100 [0xa032cec0]>{locked = No, signalled = No, valid = Yes, order = 0, context = <CFRunLoopSource context>{version = 0, info = 0x180c150, callout = __NSThreadPerformPerform (0x996c2bbf)}}
#0 0x92154a5d in CFRunLoopWakeUp ()
#1 0x996c2826 in -[NSThread _nq:] ()
#2 0x996c243d in -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] ()
#3 0x996d4adf in -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] ()
#4 0x00057a6c in -[AALayoutExecutor innerExecute:] (self=0x1a15ee0, _cmd=0x7fe3f, data=0x1e03c30) at /Users/gideon/Development/Restored/CADisplay/AALayoutExecutor.m:133
#5 0x000572ca in -[AALayoutExecutor doLayout:] (self=0x1a15ee0, _cmd=0x7fe50, data=0x1e03c30) at /Users/gideon/Development/Restored/CADisplay/AALayoutExecutor.m:50
#6 0x996acbf0 in -[NSThread main] ()
#7 0x996acba0 in __NSThread__main__ ()
#8 0x9549885d in _pthread_start ()
#9 0x954986e2 in thread_start ()
<CFRunLoop 0x1a2ac80 [0xa032cec0]>{locked = false, wakeup port = 0x5a03, stopped = false,
current mode = (none),
common modes = <CFBasicHash 0x1a23f70 [0xa032cec0]>{type = mutable set, count = 1,
entries =>
1 : <CFString 0xa0321c48 [0xa032cec0]>{contents = "kCFRunLoopDefaultMode"}
}
,
common mode items = <CFBasicHash 0x18074e0 [0xa032cec0]>{type = mutable set, count = 1,
entries =>
25 : <CFRunLoopSource 0x180a100 [0xa032cec0]>{locked = No, signalled = Yes, valid = Yes, order = 0, context = <CFRunLoopSource context>{version = 0, info = 0x180c150, callout = __NSThreadPerformPerform (0x996c2bbf)}}
}
,
modes = <CFBasicHash 0x1a2b970 [0xa032cec0]>{type = mutable set, count = 1,
entries =>
10 : <CFRunLoopMode 0x1a01d30 [0xa032cec0]>{name = kCFRunLoopDefaultMode, locked = false, port set = 0x5b03,
sources = <CFBasicHash 0x1808790 [0xa032cec0]>{type = mutable set, count = 1,
entries =>
5 : <CFRunLoopSource 0x180a100 [0xa032cec0]>{locked = No, signalled = Yes, valid = Yes, order = 0, context = <CFRunLoopSource context>{version = 0, info = 0x180c150, callout = __NSThreadPerformPerform (0x996c2bbf)}}
}
,
observers = (null),
timers = (null)
},
}
}
Thanks again
Gideon
On 08/12/2010, at 4:19 PM, Dave Keck wrote:
>
> 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 (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