Standard IPC for Python?

Philip Semanchuk philip at semanchuk.com
Tue Jan 13 17:05:21 EST 2009


On Jan 13, 2009, at 3:04 PM, Laszlo Nagy wrote:

>
>>
>> I was suggesting getting posix_ipc or sysv_ipc to compile against a  
>> compatibility library (Cygwin?) under Windows. It sounds like  
>> you're proposing something totally different, no?
> OK I see. But probably I do not want to use Cygwin because that  
> would create another dependency. I understand that posix_ipc/sysv is  
> not natively supported under windows. What about this:
>
> - create a wrapper, using ctypes, /windll / cdll/ to access API  
> functions
> - use CreateFileMapping on the page file to create shared memory (a  
> la windows: http://msdn.microsoft.com/en-us/library/aa366537.aspx)
> - use CreateEvent/WaitForSingleObject for signaling (http://msdn.microsoft.com/en-us/library/ms682396(VS.85).aspx 
> )
> - these should be enough to implement shared memory functions and  
> message queues under windows, and that might be a quick solution at  
> least for me.

Python has the mmap module which might work a lot like shared memory.  
I'm not clear on the differences, honestly.

Named pipes might be a cleaner way to implement message queues:
http://msdn.microsoft.com/en-us/library/aa365590(VS.85).aspx


> - it might also be used to emulate the same posix_ipc interface,  
> without any external dependency added (cygwin).

It'd be nice to have message queues/named pipes working under Windows.

If I were you, I'd steer clear of calling them something specific like  
"SysV" or "POSIX" messages queues. That will create an expectation of  
certain semantics, and you might find it difficult to fulfill that  
promise in certain cases (e.g. implementing the POSIX function  
mq_notify() ). If you call them Nagy message queues then no one will  
be disappointed or surprised as long as your code implements FIFO IPC.


Bye
Philip





More information about the Python-list mailing list