On Mon, 14 Aug 2006, Christopher Brown wrote:

> John are you using flock because it's the easiest & most available way to 
> sync across processes?  If you had easier access to one of the other sync 
> primitives, would you be using it (i.e. a mutex)?
> I'm just wondering what the dominant pattern is, and if we are using it 
> because something better hasn't come along.


I'm have a generic Daemon class exactly like Process.fork but 
Daemon.spawn does things like...

* Check, via a lock file, that another copy of itself isn't running
   somewhere.

* Has a method to kill all copies of itself (via fuser)

* Detaches itself from the controlling terminal (making it self a true
   Daemon) so it doesn't die if parent process dies.

* Can wait until the dameon has started, can wait for it to die.

I suspect I could use fcntl and mandatory locking, but I'm not sure that
would help with this problem.

Ps: (What do Windowsy types do instead of "Process.fork"? )


John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter / tait.co.nz
New Zealand

Carter's Clarification of Murphy's Law.

"Things only ever go right so that they may go more spectacularly wrong later."

From this principle, all of life and physics may be deduced.