Light (general) Inter-Process Mutex/Wait/Notify Synchronization?
philip at semanchuk.com
Tue Apr 28 06:53:50 CEST 2009
On Apr 27, 2009, at 8:45 PM, Gunter Henriksen wrote:
>> Try this: http://nikitathespider.com/python/shm/
> I took a look at that (especially the posix_ipc at
The posix_ipc and sysv_ipc modules both do what you're asking for. Shm
does too but sysv_ipc improves on it and has a future, unlike shm.
(I'm the author of posix_ipc and sysv_ipc and I maintain shm.)
> I am hoping
> not to plug something underneath the Python VM; I
> would rather use a socket, or use signals. If I were
> to use a C library, I imagine I would just go with a
> thin layer on top of pthread_*, but I think I will
> prefer something which uses system calls and is
> bundled with Python, slow as that approach may be.
If you don't want to use a 3rd party module you could use the
multiprocessing module which is bundled with Python 2.6 and has been
backported to Python 2.5, I think.
You could also use the standard library's ctypes to wrap the POSIX or
SysV IPC calls. This would limit you to *nix only (or WIndows +
Cygwin) but that might be OK for you. If you go this route, I
recommend wrapping the POSIX calls rather than Sys V because the Sys V
API is a little quirky.
More information about the Python-list