commit aa58a6ead2d6250f7c1433333eed590dc2ba3438 parent 522fc6612612126922e13ee8f21ef60048a10e62 Author: Michael Savage <mikejsavage@gmail.com> Date: Thu Sep 1 13:23:41 -0700 Assert dequeue_acquire/release are being used correctly Diffstat:
nonblocking_fixed_spsc_queue.h | | | 5 | +++-- |
diff --git a/nonblocking_fixed_spsc_queue.h b/nonblocking_fixed_spsc_queue.h @@ -10,6 +10,7 @@ template< typename T, size_t N > class NonblockingFixedSPSCQueue : public NonblockingQueue< T > { public: NonblockingFixedSPSCQueue() { + VAR( reader_acquired ) = false; clear(); } @@ -29,7 +30,7 @@ public: // queue is empty // call dequeue_release once you're done with the pointer T * dequeue_acquire() { - // assert( !reader_acquired ); + assert( !VAR( reader_acquired ) ); size_t r = VAR( reader_pos ); if( load_acquire( &nodes[ r ].last_op ) == READ ) return NULL; @@ -39,7 +40,7 @@ public: } void dequeue_release() { - // assert( reader_acquired ); + assert( VAR( reader_acquired ) ); VAR( reader_acquired ) = false; size_t r = VAR( reader_pos );