Re: NSRunloop performSelector needs CFRunLoopWakeUp ?
Re: NSRunloop performSelector needs CFRunLoopWakeUp ?
- Subject: Re: NSRunloop performSelector needs CFRunLoopWakeUp ?
- From: Michael Ash <email@hidden>
- Date: Sat, 24 Jan 2009 23:38:31 -0500
On Sat, Jan 24, 2009 at 11:07 PM, Adam R. Maxwell <email@hidden> wrote:
>
> On Jan 24, 2009, at 10:18 PM, Michael Ash wrote:
>
>> On Sat, Jan 24, 2009 at 3:42 PM, David Hoerl <email@hidden> wrote:
>>
> [...]
>
>>> The current app is single threaded.
>>>
>>> Can anyone shed any light on why the CFRunLoopWakeUp() call is necessary?
>>> Is
>>> there some other issue I'm missing?
>>
>> Look at the big master list of what Cocoa classes are thread safe:
>
> The OP wrote that his app is single threaded, so the lack of NSRunLoop
> thread safety shouldn't be a problem. It sounds like the event loop is
> blocking the runloop, so maybe posting a custom event would work as well as
> tickling the runloop...but that's just a guess.
Man, missing one tiny sentence is enough to make a guy look like an
idiot. Oh well, thanks for pointing it out.
I think you're right about the event. Reading the documentation:
"This method sets up a timer to perform the aSelector message on the
current thread's run loop at the start of the next run loop
iteration."
I think the words "the next run loop iteration" are key here. It will
invoke your method at the next run loop iteration... but it won't make
that iteration happen any sooner!
For what the OP wants, I think the best thing would be to just avoid
that method. Use -performSelector:withObject:afterDelay: (with a 0
delay) or a non-repeating NSTimer (with a 0 interval).
Mike
_______________________________________________
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