• 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: Bill Bumgarner <email@hidden>
  • Date: Tue, 23 May 2006 13:18:37 -0700

On May 23, 2006, at 12:49 PM, Andrei Tchijov wrote:

I guess if you can "remove" all sources from RunLopp ... but than it should stop by itself without CFRunLoopStop ... In my case I needed to stop RunLoop which was "primed" like this

[[NSRunLoop currentRunLoop] configureAsServer];

combination of getCFRunLoop and CFRunLoopStop did not work, so I end- up using Apple example

double resolution = 1.0;
BOOL isRunning;
do {
NSDate* next = [NSDate dateWithTimeIntervalSinceNow:resolution];
isRunning = [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:next];
} while (isRunning && !endRunLoop);


works great.

You really don't want to do that -- it'll make your loop "busy wait". That is, it is going to wake up and do something every second, regardless of whether or not it has anything to do. If the enclosing app has been hidden, this is going to cause the app to wake up, consume memory resources that could otherwise be devoted to what the user is really focused on.


-configureAsServer does absolutely nothing. Zero. Nada. Zilch. Total no-op.

As per the documentation (for the -run method), your run loop will stop running once all input sources have been invalidated. Figure out how to get a hold of and invalidate the input sources as necessary. That way, your run loop will consume no cycles and minimal resources when there is no work to be done.

b.bum
_______________________________________________
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:
    • NIB problem after upgrading to 2.3
      • From: Graham <email@hidden>
    • Re: Stopping a NSRunLoop
      • From: Andrei Tchijov <email@hidden>
    • RE: Stopping a NSRunLoop
      • From: "Christopher Hickman" <email@hidden>
References: 
 >Stopping a NSRunLoop (From: Rob Crawford <email@hidden>)
 >Re: Stopping a NSRunLoop (From: "Shawn Erickson" <email@hidden>)
 >Re: Stopping a NSRunLoop (From: Andrei Tchijov <email@hidden>)
 >Re: Stopping a NSRunLoop (From: Mike Blaguszewski <email@hidden>)
 >Re: Stopping a NSRunLoop (From: Andrei Tchijov <email@hidden>)

  • Prev by Date: Re: NSStatusItem and LoginItemAPI
  • Next by Date: Re: view hierarchy inspector (for debugging)
  • Previous by thread: Re: Stopping a NSRunLoop
  • Next by thread: RE: Stopping a NSRunLoop
  • Index(es):
    • Date
    • Thread