• 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: Per Ohlson <email@hidden>
  • Date: Fri, 26 Dec 2008 22:56:08 +0100

Thanks, this was exacly what I was looking for. I didn't know where to start with semaphores on OSX.
Works like a charm.


/P

26 dec 2008 kl. 02.10 skrev Ken Thomases:

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

_______________________________________________

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


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

  • Prev by Date: Re: NSToolbarItem identifier?
  • Next by Date: Single Heading in TableView Source list ...
  • Previous by thread: Re: Verify that only one launchd-started process runs at a time
  • Next by thread: processPendingChanges and disableUndoRegistration
  • Index(es):
    • Date
    • Thread