mirror of
https://github.com/boostorg/fiber.git
synced 2026-02-20 02:32:19 +00:00
remove class scheduler - fiber_context has static TLS
- detail:.scheduler was removed - fiber_context has a static thread-local pointer to the active fiber_context - fiber_context has member to pointer of fiber_manager - functions of fiber_manager are accessed only via fiber_context - if fiber f is resumed, the fiber_manager of the current active fiber f' is assigned to f -> that is necessary if f was stolen form another thread
This commit is contained in:
@@ -53,7 +53,7 @@ recursive_timed_mutex::~recursive_timed_mutex() {
|
||||
|
||||
void
|
||||
recursive_timed_mutex::lock() {
|
||||
fiber_context * f( detail::scheduler::instance()->active() );
|
||||
fiber_context * f( fiber_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
|
||||
detail::scheduler::instance()->wait( lk);
|
||||
fiber_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( detail::scheduler::instance()->active() );
|
||||
fiber_context * f( fiber_context::active() );
|
||||
BOOST_ASSERT( nullptr != f);
|
||||
for (;;) {
|
||||
detail::spinlock_lock lk( splk_);
|
||||
@@ -106,7 +106,7 @@ 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 ( ! detail::scheduler::instance()->wait_until( timeout_time, lk) ) {
|
||||
if ( ! fiber_context::active()->do_wait_until( timeout_time, lk) ) {
|
||||
lk.lock();
|
||||
std::deque< fiber_context * >::iterator i( std::find( waiting_.begin(), waiting_.end(), f) );
|
||||
if ( waiting_.end() != i) {
|
||||
|
||||
Reference in New Issue
Block a user