Mike Meyer wrote: > gabor <[EMAIL PROTECTED]> writes: > > >>ok, i ended up with the following code: >> >>def syncLog(filename,text): >> f = os.open(filename,os.O_WRONLY | os.O_APPEND) >> fcntl.flock(f,fcntl.LOCK_EX) >> os.write(f,text) >> #FIXME: what about releasing the lock? >> os.close(f) >> >>it seems to do what i need ( the flock() call waits until he can get >>access).. i just don't know if i have to unlock() the file before i >>close it.. > > > The lock should free when you close the file descriptor. Personally, > I'm a great believer in doing things explicitly rather than > implicitly,
> and would add the extra fcntl.flock(f, fcntl.LOCK_UN) call > before closing the file. done :) gabor -- http://mail.python.org/mailman/listinfo/python-list