Re: Fun with NSRunLoop <solved>
Re: Fun with NSRunLoop <solved>
- Subject: Re: Fun with NSRunLoop <solved>
- From: Lloyd Sargent <email@hidden>
- Date: Wed, 15 Aug 2001 18:17:25 -0500
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.
One way to get to all NSConnections could be this:
NSArray *connectionsArray = [NSConnection allConnections];
NSEnumerator *connectionsArrayEnumerator = [connectionsArray
objectEnumerator];
NSConnection *thisConnection;
while (thisConnection = [connectionsArrayEnumerator nextObject]) {
if ([thisConnection isValid]) {
[thisConnection invalidate];
}
}
Regards,
j o a r
Hmmm... yeah, but not exact-atactly what I wanted to do. I wanted to
EXPLICITLY tell the program to "go away". With something like:
[connection dieDieDIE]; // tell the other program to kick the
bucket
And on the other side have:
- (void) dieDieDIE
{
[connection invalidate];
exit(0);
}
On Wednesday, August 15, 2001, at 05:21 PM, Bill Bumgarner wrote:
Try declaring the method as (oneway void) and make sure there is a
protocol on the client side that is aware of the oneway voidness of
it...
That should cause the method to be invoked asynchronously.
Alternatively, use a timer to cause the execution of the -invalidate to
happen at the top of the next pass through the run loop.
b.bum
Well, this is what did the trick! It made me a happy camper (what is
interesting is that this info was on Stepwise, but I didn't know if it
applied to Cocoa or not!). So I changed my routine to:
- (oneway void) dieDieDIE
{
[connection invalidate];
exit(0);
}
And now I can explicitly tell the program it is time for it to go to its
room.
At any rate, I'm now a happy camper!
Cheers,
Lloyd
---
Canna Software Development
"No animals were immolated by the flames of Dante's Inferno in the
creation of this e-mail."