• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Stopping a NSRunLoop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stopping a NSRunLoop


  • Subject: Re: Stopping a NSRunLoop
  • From: "Shawn Erickson" <email@hidden>
  • Date: Tue, 23 May 2006 12:17:25 -0700

On 5/23/06, Rob Crawford <email@hidden> wrote:
How do you stop a NSRunLoop that is running inside a spawned off
thread with NSThread detachNewThreadSelector? I have a the run loop
for a timer to get fired once the timer fires, I want the NSRunLoop
to stop and free up the thread? In the Timer I have tried [NSThread
exit] but I seem to have threads still hanging around?

How are you running this runloop? Consider using -[NSRunLoop runUntilDate:] or -[NSRunLoop runMode:beforeDate:] and wrapping it with a loop that checks if the runloop should stop.

I believe you could also use -[NSRunLoop getCFRunLoop] to get the
CFRunLoop and then call CFRunLoopStop() on it (never tried it myself).

Also question the need for using the runloop at all for a simple
timer. You maybe could use -[NSThread sleepUntilDate:] to put your
secondary thread to sleep until some point in the future, much like a
timer callback via a runloop. Not sure of your exact needs.

-Shawn
_______________________________________________
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


  • Follow-Ups:
    • Re: Stopping a NSRunLoop
      • From: Andrei Tchijov <email@hidden>
References: 
 >Stopping a NSRunLoop (From: Rob Crawford <email@hidden>)

  • Prev by Date: Re: generating the event
  • Next by Date: Re: Stopping a NSRunLoop
  • Previous by thread: Stopping a NSRunLoop
  • Next by thread: Re: Stopping a NSRunLoop
  • Index(es):
    • Date
    • Thread