Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > I think it's even worse. The standard Python library offers > > > shared memory, but not cross-process locks. > > > > File locks are supported by the standard library (at least on Unix, > > I've not tried on Windows). They work cross-process and are a normal > > method of interprocess locking even in C code. > > I may be missing your point but I didn't realize you could use file > locks to synchronize shared memory in any useful way.
You can, absolutely. If you're sharing memory through mmap it's usually the preferred solution; fcntl locks ranges of an open file, so you lock exactly the portions of the mmap that you're using at a given time. It's not an unusual use at all, Unix programs have used file locks in this manner for upwards of a decade--things like the Apache public runtime use fcntl or flock for interprocess mutexes, and they're quite efficient. (The futexes you mentioned are a very recent Linux innovation). -- http://mail.python.org/mailman/listinfo/python-list