Re: threads vs run-loops for keeping your GUI responsive
Re: threads vs run-loops for keeping your GUI responsive
- Subject: Re: threads vs run-loops for keeping your GUI responsive
- From: "Joshua D. Orr" <email@hidden>
- Date: Fri, 9 Dec 2005 10:05:33 -0700
On Dec 9, 2005, at 7:44 AM, Niko Matsakis wrote:
Unfortunately, it is not clear to me how I might schedule a call to
this event. I have scoured the wiki and mailing list, but I can't
find much mention of this approach: everyone seems to want to
create worker threads.
I know I could use NSTimer, but again that doesn't feel quite
right: I want the function to be called ASAP, assuming that nothing
else is going on; scheduling it for a certain time seems overly
complicated.
Surely there is a way to do this? Am I missing something? Is this
not a good approach?
[[NSRunLoop currentRunLoop] performSelector:@selector(someMethod)
target:sombObject
argument:nil
order:6
modes:[NSArray arrayWithObject:@"NSDefaultRunLoopMode"]];
'order' defines the priority incase there are more then one events to
process.
I accutaly used this method in a run loop running in a separate
thread (not the main thread) and it worked great. I am sure it would
work fine in the main thread.
Anyway, This will tell the run loop to execute the method next time
execution reaches the run loop.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden