medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 16f90461a0c07a989fa7e8797e1649f6daf2dcb6
parent faf2e355f2ab13a6adac1f21f645fc6bcf8c2420
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Thu Dec 22 21:47:42 +0200

Small MPSC efficiency gain

Diffstat:
nonblocking_fixed_mpsc_queue.h | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nonblocking_fixed_mpsc_queue.h b/nonblocking_fixed_mpsc_queue.h @@ -23,9 +23,9 @@ public: bool enqueue( const T & x ) { if( load_acquire( &num_elems ) >= N ) return false; SCOPED_MUTEX_LOCK( &mutex ); - if( load_relaxed( &num_elems ) >= N ) return false; - u32 n = load_relaxed( &num_elems ); + if( n >= N ) return false; + elems[ ( head + n ) % N ] = x; store_release( &num_elems, n + 1 );