On 2008 Dec, 25, at 15:29, Per Ohlson wrote:
I would like to make shure that the second daemon started will wait for the first daemon to finish before the second starts. Can this somehow be done with SIGTERM signaling or something? Any other suggestions?
Well, what would send the SIGTERM? You'd need to have some kind of "monitor my processes" process always running. You don't want to do that.
A simpler approach would be to let your second process launch, but before it does any damage, have it acquire some kind of exclusive lock. If the lock has already been acquired by a sister process, sleep for 1 second and retry.
Maybe someone knows if Mac OS X has a facility for processes to define system-wide locks like this. If not, you could invent your own -- for example, to claim a lock, write an empty file named FooBusy.lock at some known constant path. To try and acquire the lock, see if FooBusy.lock does not exist. To relinquish the lock, delete the file FooBusy.lock. Another method, if your process is an application and has user defaults, write a key FooBusy to your app's user defaults -- same idea.
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com