critical section

lynx none at of.your.business
Sun Mar 2 14:55:57 EST 2003


On Sun, 02 Mar 2003 16:51:14 +0000, John Burton wrote:

> Are there any python facilities for synchronising access to a resource from
> two seperate processes running python programs?

i'd think that depends on what kind of resources, and what kind of
processes. if you're thinking of threaded programming, then look at the
documentation for the thread and threading modules, they've got locks and
semaphores of several kinds. if you're thinking of synchronizing access to
a file from several separate "heavyweight" processes, then you might just
have to drop to OS-specific facilities; i don't know of any generic
replacement for the fcntl module on unix, for example.

you might also look into the mutex module, which is platform-generic,
though the documentation on it in the library reference seems kindof
skimpy. from reading it alone, i don't know how you'd pass one of the
mutexes that module can create between processes, though i assume there
has to be some way to do it.

-- 
   PGP/GnuPG key (ID 1024D/3AC87BD1) available from keyservers everywhere
    Key fingerprint = FA8D 5EA4 E7DC 84B3 64BC  410C 7AEE 54CD 3AC8 7BD1
                "...if you can fill the unforgiving minute
                with sixty seconds' worth of distance run..."





More information about the Python-list mailing list