ContextFactory::~ContextFactory() = default;
-static thread_local Context* smx_current_context = nullptr;
-Context* Context::self()
-{
- return smx_current_context;
-}
-void Context::set_current(Context* self)
-{
- smx_current_context = self;
-}
+thread_local Context* Context::current_ = nullptr;
void Context::declare_context(std::size_t size)
{
class XBT_PUBLIC Context {
friend ContextFactory;
+ static thread_local Context* current_;
+
std::function<void()> code_;
actor::ActorImpl* actor_ = nullptr;
void declare_context(std::size_t size);
// Retrieving the self() context
/** @brief Retrives the current context of this thread */
- static Context* self();
+ static Context* self() { return current_; }
/** @brief Sets the current context of this thread */
- static void set_current(Context* self);
+ static void set_current(Context* self) { current_ = self; }
};
class XBT_PUBLIC AttachContext : public Context {