mirror of
https://github.com/boostorg/fiber.git
synced 2026-02-02 08:52:07 +00:00
release lock in unlock() earlier
This commit is contained in:
@@ -55,11 +55,13 @@ mutex::lock()
|
||||
{
|
||||
// notifier for main-fiber
|
||||
n = detail::scheduler::instance().notifier();
|
||||
|
||||
// store this fiber in order to be notified later
|
||||
unique_lock< detail::spinlock > lk( splk_);
|
||||
waiting_.push_back( n);
|
||||
|
||||
lk.unlock();
|
||||
|
||||
// wait until main-fiber gets notified
|
||||
while ( ! n->is_ready() )
|
||||
{
|
||||
// run scheduler
|
||||
@@ -92,6 +94,7 @@ mutex::unlock()
|
||||
n.swap( waiting_.front() );
|
||||
waiting_.pop_front();
|
||||
}
|
||||
lk.unlock();
|
||||
|
||||
state_ = UNLOCKED;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user