Fix some issues in libthread_xu's condvar implementation.
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 14 Apr 2008 20:12:41 +0000 (20:12 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 14 Apr 2008 20:12:41 +0000 (20:12 +0000)
commit3db516476dd3e8176f07bddd4f9f1825853e05a7
tree8213eea2b2c98e6a9bf7ec04b8fb56607aa3e4be
parent10192bae442ad33e063cbe1ef783b764e4a0a71d
Fix some issues in libthread_xu's condvar implementation.

* Non-broadcast mode is not guaranteed to signal just one waiter, loosen
  it up a bit to close race conditions and signal more if necessary.

* Clean up the condition structure.  Do not try to track non-broadcast
  wakeups.  Do not try to block waiting for individual wakeups... the
  spec does not require it and, in fact, doing so can create more
  problems then it solves.

* Load oldseq from cv->c_seqno *BEFORE* releasing the passed mutex to
  close a race.  The mutex is there precisely so that userland can
  guarantee that no race will occur between waiter and signaler.

Reported-by: Jordan Gordeev <jgordeev@dir.bg>,
             "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
lib/libthread_xu/thread/thr_cond.c
lib/libthread_xu/thread/thr_private.h
lib/libthread_xu/thread/thr_umtx.c
lib/libthread_xu/thread/thr_umtx.h