multiple instance on Unix

Piet van Oostrum piet at cs.uu.nl
Thu Sep 30 11:02:10 EDT 2004


>>>>> C Ginger <cginboston at hotmail.com> (CG) wrote:

CG> I know the approach to creating a lock file has been around a long time but
CG> there are certain weaknesses to it. There are a number of race conditions
CG> in it. For instance if process A detects the directory isn't there it will
CG> attempt to create it. During that same time process B might also not find
CG> it there - since A hasn't completed its create yet.

Which directory are you talking about?
If it is about using a lock file, as your first sentence applies, there
isn't a directory to be created. The lock file should be created in an
existing directory.
If you are talking about the mkdir approach: the processes are only
creating the directory with mkdir, not first checking if it exists. And
creating the directory is an atomic operation.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl



More information about the Python-list mailing list