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

fiber_context renamed to context

This commit is contained in:
Oliver Kowalke
2015-09-07 17:23:59 +02:00
parent 7f97616aa2
commit 6499bb07e7
41 changed files with 425 additions and 424 deletions

View File

@@ -53,7 +53,7 @@ recursive_timed_mutex::~recursive_timed_mutex() {
void
recursive_timed_mutex::lock() {
fiber_context * f( fiber_context::active() );
context * f( context::active() );
BOOST_ASSERT( nullptr != f);
for (;;) {
detail::spinlock_lock lk( splk_);
@@ -67,7 +67,7 @@ recursive_timed_mutex::lock() {
waiting_.push_back( f);
// suspend this fiber
fiber_context::active()->do_wait( lk);
context::active()->do_wait( lk);
}
}
@@ -88,7 +88,7 @@ recursive_timed_mutex::try_lock() {
bool
recursive_timed_mutex::try_lock_until_( std::chrono::steady_clock::time_point const& timeout_time) {
fiber_context * f( fiber_context::active() );
context * f( context::active() );
BOOST_ASSERT( nullptr != f);
for (;;) {
detail::spinlock_lock lk( splk_);
@@ -106,9 +106,9 @@ recursive_timed_mutex::try_lock_until_( std::chrono::steady_clock::time_point co
waiting_.push_back( f);
// suspend this fiber until notified or timed-out
if ( ! fiber_context::active()->do_wait_until( timeout_time, lk) ) {
if ( ! context::active()->do_wait_until( timeout_time, lk) ) {
lk.lock();
std::deque< fiber_context * >::iterator i( std::find( waiting_.begin(), waiting_.end(), f) );
std::deque< context * >::iterator i( std::find( waiting_.begin(), waiting_.end(), f) );
if ( waiting_.end() != i) {
// remove fiber from waiting-list
waiting_.erase( i);
@@ -125,14 +125,14 @@ recursive_timed_mutex::unlock() {
BOOST_ASSERT( this_fiber::get_id() == owner_);
detail::spinlock_lock lk( splk_);
fiber_context * f( nullptr);
context * f( nullptr);
if ( 0 == --count_) {
if ( ! waiting_.empty() ) {
f = waiting_.front();
waiting_.pop_front();
BOOST_ASSERT( nullptr != f);
}
owner_ = fiber_context::id();
owner_ = context::id();
state_ = mutex_status::unlocked;
lk.unlock();