X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cds%2Fcontainer%2Ffcdeque.h;h=acdf12ae00e365b0c08d1d9493523d152874b4f8;hb=6fa355b13c372e0a53d27669b10a0c9eb9b9a6b9;hp=9d75864a992b69e54416acad4ae5fbb10db072bb;hpb=763c751dc308158fc606ec0a91a9f3c8f88f0edc;p=libcds.git diff --git a/cds/container/fcdeque.h b/cds/container/fcdeque.h index 9d75864a..acdf12ae 100644 --- a/cds/container/fcdeque.h +++ b/cds/container/fcdeque.h @@ -133,7 +133,8 @@ namespace cds { namespace container { op_push_back_move, ///< Push back (move semantics) op_pop_front, ///< Pop front op_pop_back, ///< Pop back - op_clear ///< Clear + op_clear, ///< Clear + op_empty ///< Empty }; /// Flat combining publication list record @@ -332,10 +333,18 @@ namespace cds { namespace container { /** If the combining is in process the function waits while combining done. */ - bool empty() const + bool empty() { - m_FlatCombining.wait_while_combining(); - return m_Deque.empty(); + fc_record * pRec = m_FlatCombining.acquire_record(); + + if ( c_bEliminationEnabled ) + m_FlatCombining.batch_combine( op_empty, pRec, *this ); + else + m_FlatCombining.combine( op_empty, pRec, *this ); + + assert( pRec->is_done() ); + m_FlatCombining.release_record( pRec ); + return pRec->bEmpty; } /// Internal statistics @@ -396,6 +405,9 @@ namespace cds { namespace container { while ( !m_Deque.empty() ) m_Deque.pop_front(); break; + case op_empty: + pRec->bEmpty = m_Deque.empty(); + break; default: assert(false); break;