From 20196fcd696d2ce7fb695b97083543b1456366f1 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Wed, 30 Sep 2015 19:58:04 +0200 Subject: [PATCH] set active context to nullptr in ~scheduler() --- include/boost/fiber/context.hpp | 2 ++ src/context.cpp | 5 +++++ src/scheduler.cpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/include/boost/fiber/context.hpp b/include/boost/fiber/context.hpp index 667766ff..5741484c 100644 --- a/include/boost/fiber/context.hpp +++ b/include/boost/fiber/context.hpp @@ -250,6 +250,8 @@ public: static void active( context * active) noexcept; + static void reset_active() noexcept; + // main fiber context context( main_context_t); diff --git a/src/context.cpp b/src/context.cpp index 83dc7abd..db8df7da 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -44,6 +44,11 @@ context::active( context * active) noexcept { active_ = active; } +void +context::reset_active() noexcept { + active_ = nullptr; +} + void context::set_terminated_() noexcept { // protect for concurrent access diff --git a/src/scheduler.cpp b/src/scheduler.cpp index 679d96de..5c1deff1 100644 --- a/src/scheduler.cpp +++ b/src/scheduler.cpp @@ -153,6 +153,8 @@ scheduler::~scheduler() noexcept { BOOST_ASSERT( ! sched_algo_->has_ready_fibers() ); BOOST_ASSERT( remote_ready_queue_.empty() ); BOOST_ASSERT( sleep_queue_.empty() ); + // set active context to nullptr + context::reset_active(); // deallocate dispatcher-context dispatcher_ctx_.reset(); // set main-context to nullptr