Skip navigation.
 
mlRe: How can I stop running loop?
FROM : John Stiles
DATE : Tue Nov 23 22:52:59 2004

If possible, make your code use an NSTimer:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Classes/NSTimer.html

NSTimer lets you call a function periodically. You can check for data 
inside the NSTimer callback. This way you avoid threading hassles and 
don't consume the user's CPU unnecessarily. Make sure your timer has a 
reasonable polling frequency--i.e. checking 10 or 20 times a second 
should be more than enough if all you're doing is polling for data.


On Nov 23, 2004, at 1:48 PM, Mai Bui wrote:

> Hi,
>
> I'm very new in cocoa and still learning it.  I would like to write 
> application which is run forever (to acquire some data) until the user 
> enter some key (i.e "Q") and application will stop.
> I think about use multithread to do it: the first thread runs a 
> while(1) loop, the second one waits, checks and gets input from the 
> user to set the flag "Done" which is the  first thread can see it and 
> stop.  My logic is on the right track?  But .... I do not know how to 
> implement with the second thread.
>
> Thanks for your ideas, your guide in advance.
>
> Mai.
>
>
> Mai Bui N.
> MPL - SIO
> <email_removed>
> (858)534-4733
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlHow can I stop running loop? Mai Bui Nov 23, 22:48
mlRe: How can I stop running loop? John Stiles Nov 23, 22:52
mlRe: How can I stop running loop? Shawn Erickson Nov 23, 23:09
mlRe: How can I stop running loop? Mai Bui Dec 2, 05:48
mlRe: How can I stop running loop? Shawn Erickson Dec 2, 17:23