int main() { boost::mutex m; m.lock(); #if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) auto #else boost::unique_lock<boost::mutex> #endif lk = boost::make_unique_lock(m, boost::adopt_lock); BOOST_TEST(lk.mutex() == &m); BOOST_TEST(lk.owns_lock() == true); return boost::report_errors(); }
void signal_locked(boost::int64_t count, boost::unique_lock<mutex_type> l) { HPX_ASSERT(l.owns_lock()); mutex_type* mtx = l.mutex(); // release no more threads than we get resources value_ += count; for (boost::int64_t i = 0; value_ >= 0 && i < count; ++i) { // notify_one() returns false if no more threads are // waiting if (!cond_.notify_one(std::move(l))) break; l = boost::unique_lock<mutex_type>(*mtx); } }