write to the same file from multiple processes at the same time?

gabor gabor at nekomancer.net
Mon May 30 05:12:57 EDT 2005


Jp Calderone wrote:
> To briefly re-summarize, when you 
> want to acquire a lock, attempt to create a directory with a well-known 
> name.  When you are done with it, delete the directory.  This works 
> across all platforms and filesystems likely to be encountered by a 
> Python program.

thanks...

but the problem now is that the cgi will have to wait for that directory 
  to be gone, when he is invoked.. and i do not want to code that :)
i'm too lazy..

so basically i want the code to TRY to write to the file, and WAIT if it 
  is opened for write right now...

something like a mutex-synchronized block of the code...

gabor



More information about the Python-list mailing list