On Thu, 30 May 2013, Edward Ned Harvey (openindiana) wrote:
I'm looking around, and not finding any great answers. So far, using mkdir, it's easy to see there exists a way to do mutex locking, and you could easily write your PID into the subdir that was just created; unfortunately, the problem is when a script gets killed, leaving the stale lock. So I'm looking for something better than "mkdir" to use for locking.
Hard links from an existing file are a robust atomic "locking" mechanism. These have been used on mail servers for several tens of years such as in /var/mail. The shell supports a signal trap mechanism so you can handle delivery of a signal and remove the hard link.
The main thing which is lacking is a way to wait for a lock beyond simple polling.
Bob -- Bob Friesenhahn [email protected], http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ _______________________________________________ OpenIndiana-discuss mailing list [email protected] http://openindiana.org/mailman/listinfo/openindiana-discuss
