diff --git a/src/mutex.cpp b/src/mutex.cpp index 8534ea04..3c2e5d12 100644 --- a/src/mutex.cpp +++ b/src/mutex.cpp @@ -48,7 +48,7 @@ mutex::lock() unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // TODO: prevent notification (set_ready()) of fiber before set to waiting-state // suspend this fiber @@ -63,7 +63,7 @@ mutex::lock() unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // wait until main-fiber gets notified while ( ! n->is_ready() ) @@ -106,7 +106,7 @@ mutex::unlock() n.swap( waiting_.front() ); waiting_.pop_front(); } - splk_.unlock(); + lk.unlock(); owner_ = detail::fiber_base::id(); state_ = UNLOCKED; diff --git a/src/recursive_mutex.cpp b/src/recursive_mutex.cpp index bcc6359e..825d730c 100644 --- a/src/recursive_mutex.cpp +++ b/src/recursive_mutex.cpp @@ -56,7 +56,7 @@ recursive_mutex::lock() unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // TODO: prevent notification (set_ready()) of fiber before set to waiting-state // suspend this fiber @@ -71,7 +71,7 @@ recursive_mutex::lock() unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // wait until main-fiber gets notified while ( ! n->is_ready() ) @@ -127,7 +127,7 @@ recursive_mutex::unlock() n.swap( waiting_.front() ); waiting_.pop_front(); } - splk_.unlock(); + lk.unlock(); owner_ = detail::fiber_base::id(); state_ = UNLOCKED; diff --git a/src/recursive_timed_mutex.cpp b/src/recursive_timed_mutex.cpp index a9e834df..f46fb32e 100644 --- a/src/recursive_timed_mutex.cpp +++ b/src/recursive_timed_mutex.cpp @@ -56,7 +56,7 @@ recursive_timed_mutex::lock() unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // suspend this fiber detail::scheduler::instance()->wait(); @@ -70,7 +70,7 @@ recursive_timed_mutex::lock() unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // wait until main-fiber gets notified while ( ! n->is_ready() ) @@ -132,7 +132,7 @@ recursive_timed_mutex::try_lock_until( clock_type::time_point const& timeout_tim unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // suspend this fiber until notified or timed-out if ( ! detail::scheduler::instance()->wait_until( timeout_time) ) { @@ -140,7 +140,7 @@ recursive_timed_mutex::try_lock_until( clock_type::time_point const& timeout_tim // remove fiber from waiting-list waiting_.erase( std::find( waiting_.begin(), waiting_.end(), n) ); - splk_.unlock(); + lk.unlock(); return false; } } @@ -153,7 +153,7 @@ recursive_timed_mutex::try_lock_until( clock_type::time_point const& timeout_tim unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // wait until main-fiber gets notified while ( ! n->is_ready() ) @@ -164,7 +164,7 @@ recursive_timed_mutex::try_lock_until( clock_type::time_point const& timeout_tim // remove fiber from waiting-list waiting_.erase( std::find( waiting_.begin(), waiting_.end(), n) ); - splk_.unlock(); + lk.unlock(); return false; } // run scheduler @@ -178,7 +178,7 @@ recursive_timed_mutex::try_lock_until( clock_type::time_point const& timeout_tim // remove fiber from waiting-list waiting_.erase( std::find( waiting_.begin(), waiting_.end(), n) ); - splk_.unlock(); + lk.unlock(); throw; } } @@ -209,7 +209,7 @@ recursive_timed_mutex::unlock() n.swap( waiting_.front() ); waiting_.pop_front(); } - splk_.unlock(); + lk.unlock(); owner_ = detail::fiber_base::id(); state_ = UNLOCKED; diff --git a/src/timed_mutex.cpp b/src/timed_mutex.cpp index c3f756d6..d3be3f5e 100644 --- a/src/timed_mutex.cpp +++ b/src/timed_mutex.cpp @@ -48,7 +48,7 @@ timed_mutex::lock() unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // suspend this fiber detail::scheduler::instance()->wait(); @@ -62,7 +62,7 @@ timed_mutex::lock() unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // wait until main-fiber gets notified while ( ! n->is_ready() ) @@ -108,7 +108,7 @@ timed_mutex::try_lock_until( clock_type::time_point const& timeout_time) unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // suspend this fiber until notified or timed-out if ( ! detail::scheduler::instance()->wait_until( timeout_time) ) { @@ -116,7 +116,7 @@ timed_mutex::try_lock_until( clock_type::time_point const& timeout_time) // remove fiber from waiting-list waiting_.erase( std::find( waiting_.begin(), waiting_.end(), n) ); - splk_.unlock(); + lk.unlock(); return false; } } @@ -129,7 +129,7 @@ timed_mutex::try_lock_until( clock_type::time_point const& timeout_time) unique_lock< detail::spinlock > lk( splk_); // store this fiber in order to be notified later waiting_.push_back( n); - splk_.unlock(); + lk.unlock(); // wait until main-fiber gets notified while ( ! n->is_ready() ) @@ -140,7 +140,7 @@ timed_mutex::try_lock_until( clock_type::time_point const& timeout_time) // remove fiber from waiting-list waiting_.erase( std::find( waiting_.begin(), waiting_.end(), n) ); - splk_.unlock(); + lk.unlock(); return false; } // run scheduler @@ -154,7 +154,7 @@ timed_mutex::try_lock_until( clock_type::time_point const& timeout_time) // remove fiber from waiting-list waiting_.erase( std::find( waiting_.begin(), waiting_.end(), n) ); - splk_.unlock(); + lk.unlock(); throw; } } @@ -182,7 +182,7 @@ timed_mutex::unlock() n.swap( waiting_.front() ); waiting_.pop_front(); } - splk_.unlock(); + lk.unlock(); owner_ = detail::fiber_base::id(); state_ = UNLOCKED;