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; }
void SCOCacheMountPoint::newMountPointStage1_() { LOG_TRACE(path_); if (!fs::exists(path_)) { throw fungi::IOException("MountPoint does not exist", path_.string().c_str(), ENOENT); } else { if (!empty_()) { throw fungi::IOException("MountPoint not empty", path_.string().c_str(), EEXIST); } } validateParams_(); bu::basic_random_generator<boost::mt19937> uuidgen; uuid_ = uuidgen(); LOG_DEBUG(path_ << ": creation stage 1 succeeded"); }
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 dequeue( msg_type & msg, boost::xtime const& xt) { typename boost::mutex::scoped_lock lock( mtx_); if ( active_ == false && empty_() ) return false; not_empty_cond_.timed_wait( lock, xt, boost::bind( & Queue< T, Q >::consumers_activate_, this) ); if ( empty_() ) msg.reset(); else dequeue_( msg); if ( active_ == true && queue_.size() <= low_water_mark_) not_full_cond_.notify_one(); return msg ? true : false; }
bool dequeue( msg_type & msg) { typename boost::mutex::scoped_lock lock( mtx_); if ( active_ == false && empty_() ) return false; while (empty_() ){ not_empty_cond_.wait( lock, boost::bind( & Queue< T, Q >::consumers_activate_, this) ); } dequeue_( msg); if ( active_ == true && queue_.size() <= low_water_mark_) { not_full_cond_.notify_one(); } return msg ? true : false; }
bool try_take_( callable & ca) { if ( empty_() ) return false; callable tmp( queue_.top().ca); queue_.pop(); ca.swap( tmp); return ! ca.empty(); }
Runnable* QueueOfRunnables::get_with_timeout(long timeout) { if(empty() && !destructed_) { oneElementAppear_.wait(timeout); } if (destructed_) { throw Destructed(); } MutexLocker guard(arrivedMutex_); return empty_() ? NULL : real_get_(); }
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; }
Runnable* QueueOfRunnables::try_get() { MutexLocker guard(arrivedMutex_); return empty_() ? NULL : real_get_(); }
bool empty() const { mutex::scoped_lock lk( head_mtx_); return empty_(); }
bool consumers_activate_() const { return active_ == false || ! empty_(); }
bool empty() { typename boost::mutex::scoped_lock lock( mtx_); return empty_(); }
bool empty() const { shared_lock< shared_mutex > lk( mtx_); return empty_(); }
bool empty() const { // Non-virtual interface return empty_(); }