From 893a351195a2997133892ffac80573a9984ba4cf Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 18 May 2004 20:18:14 +0000 Subject: [BZ #163] Update. 2004-05-18 Petter Reinholdtsen * 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] --- nptl/DESIGN-condvar.txt | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'nptl/DESIGN-condvar.txt') 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); } -- cgit 1.4.1