• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Verify that only one launchd-started process runs at a time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Jerry Krinock <email@hidden>
  • Date: Thu, 25 Dec 2008 16:22:59 -0800


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 (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


  • Follow-Ups:
    • Re: Verify that only one launchd-started process runs at a time
      • From: Ken Thomases <email@hidden>
References: 
 >Verify that only one launchd-started process runs at a time (From: Per Ohlson <email@hidden>)

  • Prev by Date: Verify that only one launchd-started process runs at a time
  • Next by Date: Re: Verify that only one launchd-started process runs at a time
  • Previous by thread: Verify that only one launchd-started process runs at a time
  • Next by thread: Re: Verify that only one launchd-started process runs at a time
  • Index(es):
    • Date
    • Thread