Re: NSRunloop performSelector needs CFRunLoopWakeUp ?
Re: NSRunloop performSelector needs CFRunLoopWakeUp ?
- Subject: Re: NSRunloop performSelector needs CFRunLoopWakeUp ?
- From: David Hoerl <email@hidden>
- Date: Sun, 25 Jan 2009 12:47:36 -0500
Thanks to those who have posted on this, and suggested workarounds.
However, in a simple non-threaded app, this call should work, no? And
perhaps the 0 time timer would also suffer the same fate.
The project has a checkbox so the user can enable the CFWakeup.
To convince myself this was not caused by some other part of my code,
I created a bare bones project with a NSApp delegate, that uses two
methods to post the performSelector and the other to responds to it.
The project is on my idisk, and is called RunLoopWoes.zip:
http://idisk.mac.com/dhoerl-Public
Also, I did post a bug on the problem along with the sample project:
<rdar://6525609>.
If someone has the time to independently verify that in fact this
issue occurs on another system (and its not due to some defect in my
system) that would be just great (and please let me know!).
David
PS: well, I re-read the Threading Programming Guide, and I saw
"performSelectorOnMainThread", so tried it in my demo project. Bingo,
it works as expected:
[self performSelectorOnMainThread:@selector(getNextTask)
withObject:nil waitUntilDone:NO];
Also, this worked too:
[self performSelector:@selector(getNextFrame) withObject:nil afterDelay:0.0];
Both of these methods essentially queue the selector so it will be
sent during the next run loop cycle, and NOT cause it to be executed
immediately. It would appear that both are thread safe too.
_______________________________________________
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