bool take( value_type & va, chrono::system_clock::time_point const& abs_time) { mutex::scoped_lock lk( head_mtx_); bool empty = empty_(); if ( ! active_() && empty) return false; if ( empty) { try { while ( active_() && empty_() ) { if ( ! not_empty_cond_.timed_wait( lk, abs_time) ) return false; } } catch ( fiber_interrupted const&) { return false; } } if ( ! active_() && empty_() ) return false; swap( va, head_->va); pop_head_(); return va; }
bool try_take( value_type & va) { mutex::scoped_lock lk( head_mtx_); if ( empty_() ) return false; swap( va, head_->va); pop_head_(); return va; }
bool take( value_type & va) { mutex::scoped_lock lk( head_mtx_); bool empty = empty_(); if ( ! active_() && empty) return false; if ( empty) { try { while ( active_() && empty_() ) not_empty_cond_.wait( lk); } catch ( fiber_interrupted const&) { return false; } } if ( ! active_() && empty_() ) return false; swap( va, head_->va); pop_head_(); return va; }
value_type value_pop_( std::unique_lock< mutex > & lk) { BOOST_ASSERT( ! is_empty_() ); auto old_head = pop_head_(); return std::move( old_head->va); }