Re: Fun with NSRunLoop
Re: Fun with NSRunLoop
- Subject: Re: Fun with NSRunLoop
- From: Bill Bumgarner <email@hidden>
- Date: Wed, 15 Aug 2001 17:02:24 -0400
For a run loop to stop running, it needs to have all timers, event
handlers, and everything else removed.
In this case, you likely only have one "event handler" in that you have
an NSConnection that is running. To cause the run loop to stop, simply
invalidate the connection. When the last "thing listening for stuff to
happen" is invalidated/removed, the Run loop will stop.
If the run loop doesn't stop, there is something else waiting for
something to happen. If that appears to be the case, create a subclass
of NSRunLoop, pose as NSRunLoop and have a look at everything that
registers itself with the run loop in question. It'll then be your task
to figure out how to make all of those things stop listening for events
and, as such, remove themselves from the event loop.
An example:
http://www.codefab.com/pub/unsupported/AppKitRunLoopHacque.tar.gz
The above was written on March 13th of 1999-- it should still "just
work", but may need to be patched slightly. In any case, it is an
interesting hacque in that it lets you see *exactly* how many things are
added/removed from the run loop as a normal part of the application's
life cycle.
---
If you don't need to worry about properly shutting down the NSRunLoop,
simply call NSConnection's -invalidate, then exit(0)....
b.bum
On Wednesday, August 15, 2001, at 04:21 PM, cocoa-dev-
email@hidden wrote:
....
Now I want another program to send a message to the to tool. Okay, no
problem. But how can I programmatically tell the runloop to, in essence,
stop running? I've tried a lot of things and have had no success! I was
hoping there was something like:
[theRunLoop stopRunning]; or [theRunLoop dieDieDIE];
....