mirror of
https://github.com/boostorg/fiber.git
synced 2026-02-13 00:12:17 +00:00
small fixes
This commit is contained in:
@@ -162,7 +162,7 @@ public:
|
||||
|
||||
static context * active() noexcept;
|
||||
|
||||
static context * active( context * active) noexcept;
|
||||
static void active( context * active) noexcept;
|
||||
|
||||
context * nxt;
|
||||
|
||||
|
||||
@@ -33,12 +33,10 @@ context::active() noexcept {
|
||||
return active_;
|
||||
}
|
||||
|
||||
context *
|
||||
void
|
||||
context::active( context * active) noexcept {
|
||||
BOOST_ASSERT( nullptr != active);
|
||||
context * old( active_);
|
||||
active_ = active;
|
||||
return old;
|
||||
}
|
||||
|
||||
context::~context() {
|
||||
@@ -111,9 +109,9 @@ context::get_fss_data( void const * vp) const {
|
||||
|
||||
void
|
||||
context::set_fss_data( void const * vp,
|
||||
detail::fss_cleanup_function::ptr_t const& cleanup_fn,
|
||||
void * data,
|
||||
bool cleanup_existing) {
|
||||
detail::fss_cleanup_function::ptr_t const& cleanup_fn,
|
||||
void * data,
|
||||
bool cleanup_existing) {
|
||||
BOOST_ASSERT( cleanup_fn);
|
||||
|
||||
uintptr_t key( reinterpret_cast< uintptr_t >( vp) );
|
||||
@@ -147,13 +145,11 @@ context::set_properties( fiber_properties * props) {
|
||||
}
|
||||
|
||||
void
|
||||
context::do_spawn( fiber const& f_) {
|
||||
context::do_spawn( fiber const& f) {
|
||||
BOOST_ASSERT( nullptr != scheduler_);
|
||||
BOOST_ASSERT( this == active_);
|
||||
|
||||
context * f( f_.impl_.get() );
|
||||
f->set_scheduler( scheduler_);
|
||||
scheduler_->spawn( f);
|
||||
scheduler_->spawn( f.impl_.get() );
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -131,8 +131,6 @@ scheduler::run( context * af) {
|
||||
BOOST_ASSERT( nullptr != af);
|
||||
BOOST_ASSERT( context::active() == af);
|
||||
for (;;) {
|
||||
// destroy terminated fibers from terminated-queue
|
||||
tqueue_.clear();
|
||||
// move all fibers which are ready (state_ready)
|
||||
// from waiting-queue to the runnable-queue
|
||||
wqueue_.move_to( sched_algo_.get() );
|
||||
@@ -142,6 +140,8 @@ scheduler::run( context * af) {
|
||||
BOOST_ASSERT_MSG( f->is_ready(), "fiber with invalid state in ready-queue");
|
||||
// resume fiber f
|
||||
resume_( af, f);
|
||||
// destroy terminated fibers from terminated-queue
|
||||
tqueue_.clear();
|
||||
return;
|
||||
} else {
|
||||
// no fibers ready to run; the thread should sleep
|
||||
|
||||
Reference in New Issue
Block a user