Re: Verify that only one launchd-started process runs at a time
Re: Verify that only one launchd-started process runs at a time
- Subject: Re: Verify that only one launchd-started process runs at a time
- From: Ken Thomases <email@hidden>
- Date: Thu, 25 Dec 2008 19:10:07 -0600
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 (email@hidden)
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:
This email sent to email@hidden