On Dec 25, 2008, at 6:22 PM, Jerry Krinock wrote:

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.

See flock(2).  Or POSIX semaphores (sem_open, sem_wait, etc.).

Cheers,
Ken

_______________________________________________

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

Reply via email to