Re: To thread or not to thread?
Re: To thread or not to thread?
- Subject: Re: To thread or not to thread?
- From: email@hidden
- Date: Mon, 30 Jan 2006 16:06:53 -0800
Actually, you should be able to do this using just NSRunloops - (void)
performSelector:(SEL)aSelector target:(id)target argument:(id)
anArgument order:(unsigned)order modes:(NSArray*)modes. Use that
whenever your checkbox is checked, and then in the method that you're
invoking, if the checkbox is still checked, call it again.
That avoids the overhead of allocating and managing an NSTimer. It
also guarantees that your method will be called as fast as possible
without blocking the runloop. There is the possibility of the method
being enqueued multiple times, if the state of the checkbox changes
rapidly, but only if you're changing it programmatically (I think).
If nothing else, you could always use a BOOL somewhere to indicate
whether you've already enqueued the message or not.
Wade
_______________________________________________
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