This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kristjan.jonsson
Recipients brian.curtin, jyasskin, kristjan.jonsson, pitrou, terry.reedy, tim.golden
Date 2010-08-09.08:40:16
SpamBayes Score 2.7729498e-05
Marked as misclassified No
Message-id <1281343219.44.0.606270483907.issue8411@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-08-09 08:40:19kristjan.jonssonsetrecipients: + kristjan.jonsson, terry.reedy, pitrou, jyasskin, tim.golden, brian.curtin
2010-08-09 08:40:19kristjan.jonssonsetmessageid: <1281343219.44.0.606270483907.issue8411@psf.upfronthosting.co.za>
2010-08-09 08:40:17kristjan.jonssonlinkissue8411 messages
2010-08-09 08:40:16kristjan.jonssoncreate