diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-05-18 20:18:14 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-05-18 20:18:14 +0000 |
commit | 893a351195a2997133892ffac80573a9984ba4cf (patch) | |
tree | ad1b9f1a9e7d55b25353c57f9fbd5f76c4804054 /nptl/DESIGN-condvar.txt | |
parent | d40eb37aad4145ae4d047b6d7f633f740bf3a610 (diff) | |
download | glibc-893a351195a2997133892ffac80573a9984ba4cf.tar.gz glibc-893a351195a2997133892ffac80573a9984ba4cf.tar.xz glibc-893a351195a2997133892ffac80573a9984ba4cf.zip |
[BZ #163]
Update. 2004-05-18 Petter Reinholdtsen <pere@hungry.com> * locales/sl_SI [LC_TIME]: Correct d_fmt date format from '22.06.2003' to '22. 06. 2003'. Change requested from Aleks Reinhardt, and approved by the locale author Borka Jerman-Blazic. [BZ #163]
Diffstat (limited to 'nptl/DESIGN-condvar.txt')
-rw-r--r-- | nptl/DESIGN-condvar.txt | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/nptl/DESIGN-condvar.txt b/nptl/DESIGN-condvar.txt index cb0f59c823..4845251c75 100644 --- a/nptl/DESIGN-condvar.txt +++ b/nptl/DESIGN-condvar.txt @@ -23,16 +23,30 @@ struct pthread_cond_t { sequence number of last woken thread. + uint32_t broadcast_seq; + +} + + +struct cv_data { + + pthread_cond_t *cv; + + uint32_t bc_seq + } -cleanup_handler(cv) +cleanup_handler(cv_data) { + cv = cv_data->cv; lll_lock(cv->lock); - ++cv->wakeup_seq; - ++cv->woken_seq; + if (cv_data->bc_seq == cv->broadcast_seq) { + ++cv->wakeup_seq; + ++cv->woken_seq; + } /* make sure no signal gets lost. */ FUTEX_WAKE(cv->wakeup_seq, ALL); @@ -50,12 +64,14 @@ cond_timedwait(cv, mutex, timeout): ++cv->total_seq; val = seq = cv->wakeup_seq; + cv_data.bc = cv->broadcast_seq; + cv_data.cv = cv; while (1) { lll_unlock(cv->lock); - enable_async + enable_async(&cv_data); ret = FUTEX_WAIT(cv->wakeup_seq, val, timeout); @@ -63,6 +79,9 @@ cond_timedwait(cv, mutex, timeout): lll_lock(cv->lock); + if (bc != cv->broadcast_seq) + goto bc_out; + val = cv->wakeup_seq; if (val != seq && cv->woken_seq != val) { @@ -78,6 +97,7 @@ cond_timedwait(cv, mutex, timeout): ++cv->woken_seq; + bc_out: lll_unlock(cv->lock); cleanup_pop @@ -105,6 +125,8 @@ cond_broadcast(cv) if (cv->total_seq > cv->wakeup_seq) { cv->wakeup_seq = cv->total_seq; + cv->woken_seq = cv->total_seq; + ++cv->broadcast_seq; FUTEX_WAKE(cv->wakeup_seq, ALL); } |