Kristján Valur Jónsson <krist...@ccpgames.com> added the comment:

Oh dear.  I was assuming that the mutex+condition variable were the actual 
implementation mostly in use on pthreads.  This is because of David's GIL open 
talk at pycon, where we were looking at the source and bickering about the 
placement of "pthread_cond_signal()" being after the "pthread_mutex_unlock()" 
call.  

In which case, more than half of this thread is invalid.  I could, perhaps, 
start a new defect: "semaphore emulation using condition variable is broken".

However, I just asked a colleague with a os X to compile python 2.7 and 
_POSIX_SEMAPHORES isn't defined, and so, it is running using the emulation.  
Why, I wonder?  Isn't it defined in unistd.h?

Martin, I don't know if you were suggesting that a "fair" mutex would make the 
emulated semaphore fair too.  You probably weren't, but just in case, the 
fairness of the mutex is immaterial because it is only held for a short time to 
guard the internal state of the "semaphore".  You won't see threads queing up 
on it, but they will queue on the Contition variable.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8299>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to