Comment 16 for bug 1327946

Revision history for this message
Philip Semanchuk (8-ubuntuone-20-ick) wrote :

Hi all,
I'm the author and maintainer of both posix_ipc and sysv_ipc. Yuriy Taraday brought this thread to my attention.

I wanted to comment that the clever idea of writing the pid to a semaphore's value won't work under OS X because OS X doesn’t support sem_getvalue(). Under OS X, attempting to access sem.value on a posix_ipc semaphore raises an AttributeError.

Sys V semaphores and SEM_UNDO might be a better option, but note that it might introduce some unpredictable behavior in certain circumstances. See the BUGS section here:
http://man7.org/linux/man-pages/man2/semop.2.html