Re: Stopping a NSRunLoop
Re: Stopping a NSRunLoop
- Subject: Re: Stopping a NSRunLoop
- From: Andrei Tchijov <email@hidden>
- Date: Tue, 23 May 2006 15:49:48 -0400
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.
On May 23, 2006, at 3:43 PM, Mike Blaguszewski wrote:
On May 23, 2006, at 3:22 PM, Andrei Tchijov wrote:
Do not bother with getCFRunLoop/CFRunLoopStop. It does not work.
Your own loop with terminal condition and runMode:beforeDate: the
only way to go (this is actually the way promoted in Apple doc
about Run Loop)
I've had some success starting a runloop with CFRunLoopRun(), then
using (I believe) CFRunLoopStop(CFRunLoopGetCurrent()) to end it.
This was in the main thread of a Foundation tool, though, where I
needed NSNotifications to work. And I don't have the code handy
anymore to verify the details.
--
Mike Blaguszewski / Ambrosia Software, Inc.
_______________________________________________
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
_______________________________________________
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