Re: Proper way to run runloop for DO server?
Re: Proper way to run runloop for DO server?
- Subject: Re: Proper way to run runloop for DO server?
- From: Chris Kane <email@hidden>
- Date: Thu, 20 Mar 2003 20:05:01 -0800
On Tuesday, March 18, 2003, at 06:11 PM, Jim Correia wrote:
What is the proper way to run the runloop for a daemon that sits there
and handles message via distributed objects?
One of the messages it handles is a message that tells it the process
should cleanly exit.
The best bet is to use -run and expect that never to return (but include
code to handle the case where it might). -run is a convenience to run
forever (so don't use it if you don't want it to run forever), which is
typical for a server after it's done all its setup.
If you want to quit the server, just exit() after doing any cleanup you
want to do, upon reaching the triggering condition as a callout from the
run loop (in your case, while handing the exit message). Figuring out
how to make -run return is a waste of energy, though people often fall
into that trap. When you want to terminate, just do so.
Should I send the current NSRunLoop a configureAsServer message, then a
run message? Then exit with runloop with CFRunLoopStop when my server
gets the exit message?
-configureAsServer doesn't do anything on Mach, so I wouldn't call it.
Chris Kane
Cocoa Frameworks, Apple
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.