2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-01 20:42:08 +00:00

fix using intruisve::list<>

This commit is contained in:
Oliver Kowalke
2015-09-10 18:08:10 +02:00
parent 2173200c14
commit d3843efbe0
17 changed files with 184 additions and 157 deletions

View File

@@ -37,12 +37,12 @@ mutex::mutex() :
splk_(),
state_( mutex_status::unlocked),
owner_(),
waiting_() {
wait_queue_() {
}
mutex::~mutex() {
BOOST_ASSERT( ! owner_);
BOOST_ASSERT( waiting_.empty() );
BOOST_ASSERT( wait_queue_.empty() );
}
void
@@ -58,7 +58,7 @@ mutex::lock() {
// store this fiber in order to be notified later
BOOST_ASSERT( ! f->wait_is_linked() );
waiting_.push_back( * f);
wait_queue_.push_back( * f);
// suspend this fiber
context::active()->do_wait( lk);
@@ -87,9 +87,9 @@ mutex::unlock() {
detail::spinlock_lock lk( splk_);
context * f( nullptr);
if ( ! waiting_.empty() ) {
f = & waiting_.front();
waiting_.pop_front();
if ( ! wait_queue_.empty() ) {
f = & wait_queue_.front();
wait_queue_.pop_front();
BOOST_ASSERT( nullptr != f);
}
owner_ = context::id();