2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-17 01:32:32 +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

@@ -42,13 +42,13 @@ recursive_mutex::recursive_mutex() :
state_( mutex_status::unlocked),
owner_(),
count_( 0),
waiting_() {
wait_queue_() {
}
recursive_mutex::~recursive_mutex() {
BOOST_ASSERT( ! owner_);
BOOST_ASSERT( 0 == count_);
BOOST_ASSERT( waiting_.empty() );
BOOST_ASSERT( wait_queue_.empty() );
}
void
@@ -64,7 +64,7 @@ recursive_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);
@@ -94,9 +94,9 @@ recursive_mutex::unlock() {
detail::spinlock_lock lk( splk_);
context * f( nullptr);
if ( 0 == --count_) {
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();