ContextFactory::~ContextFactory() = default;
-static thread_local smx_context_t smx_current_context;
+static thread_local smx_context_t smx_current_context = nullptr;
Context* Context::self()
{
return smx_current_context;
set_current(this);
}
-Context::~Context() = default;
+Context::~Context()
+{
+ if (self() == this)
+ set_current(nullptr);
+}
void Context::stop()
{
{
simix_global->context_factory->run_all();
}
-
-/** @brief returns the current running context */
-smx_context_t SIMIX_context_self()
-{
- if (simix_global && simix_global->context_factory)
- return simgrid::kernel::context::Context::self();
- else
- return nullptr;
-}