On 29/09/06, Sybren Stuvel <[EMAIL PROTECTED]> wrote:
> Checking for a lock, and later acquiring the lock, seems non-atomic to
> me. It's easier to simply create a lock directory. If it fails, the
> dir already exists and someone else holds the lock. If it succeeds,
> the lock is immediately yours, since you just created the directory.
> This is atomic on most OSses AFAIK.

My reply was in response to a post that mentioned a known problem with
this,  what happens when the previously running program doesn't exit
gracefully, and leaves the directory in place ??

If the directory creation fails (because it already exists), it
doesn't mean there is another instance of the program running, it
means that the directory hasn't yet been deleted by its creator.

   :)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to