diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-09-25 02:38:03 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-09-25 02:38:03 -0400 |
commit | cba4e1c0a3423ed07ef5c79f6e29360996f32fd7 (patch) | |
tree | b0b71361525510d796f448dd506d8f8f6140ca41 /src/internal/pthread_impl.h | |
parent | 97c5b5a87c3d9df54278e1073d6177f77536bd32 (diff) | |
download | musl-cba4e1c0a3423ed07ef5c79f6e29360996f32fd7.tar.gz musl-cba4e1c0a3423ed07ef5c79f6e29360996f32fd7.tar.xz musl-cba4e1c0a3423ed07ef5c79f6e29360996f32fd7.zip |
new futex-requeue-based pthread_cond_broadcast implementation
this avoids the "stampede effect" where pthread_cond_broadcast would result in all waiters waking up simultaneously, only to immediately contend for the mutex and go back to sleep.
Diffstat (limited to 'src/internal/pthread_impl.h')
-rw-r--r-- | src/internal/pthread_impl.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h index d123e5e3..4c743d2e 100644 --- a/src/internal/pthread_impl.h +++ b/src/internal/pthread_impl.h @@ -64,9 +64,12 @@ struct __timer { #define _m_prev __u.__p[3] #define _m_next __u.__p[4] #define _m_count __u.__i[5] -#define _c_block __u.__i[0] -#define _c_clock __u.__i[1] -#define _c_waiters __u.__i[2] +#define _c_mutex __u.__p[0] +#define _c_block __u.__i[2] +#define _c_waiters __u.__i[3] +#define _c_clock __u.__i[4] +#define _c_bcast __u.__i[5] +#define _c_leavers __u.__i[6] #define _rw_lock __u.__i[0] #define _rw_waiters __u.__i[1] #define _b_inst __u.__p[0] |