locking files on Linux

andrea crotti andrea.crotti.0 at gmail.com
Thu Oct 18 11:08:08 EDT 2012


2012/10/18 Oscar Benjamin <oscar.j.benjamin at gmail.com>:
>
> Why not come up with a test that actually shows you if it works? Here
> are two suggestions:
>
> 1) Use time.sleep() so that you know how long the lock is held for.
> 2) Write different data into the file from each process and see what
> you end up with.
>


Ok thanks I will try, but I thought that what I did was the worst
possible case, because I'm opening and writing on the same file from
two different processes, locking the file with LOCK_EX.

It should not open it at all as far as I understood...



More information about the Python-list mailing list