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

You wan't to have the Semaphore with a max count of infinite because
a) of the "race condition" mentioned (actually, possible discrepancy between 
n_waiting and actual semaphore value), which can cause the semaphore count to 
temporarily go positive, and
b) If you implement _cond_broadcast(), which would have code like:
  int waiting = cond->n_waiting;
  if (waiting > 0) {
    cond->n_waiting = 0
    ReleaseSemaphore(cond->sem, waiting, 0);
}

The semaphore value going above 0 is not a "bug" but an implementation detail 
stemming from the fact that n_waiting cannot reliably reflect the semaphore 
state at each particular time.  Due to locking, it may lag behind the state a 
little bit.

----------

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

Reply via email to