X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/af537f85d61a303b8f2c0b0707fbb3116dca2126..92061e0bc62b9a2ef3bdc041e5e9fe716ada1120:/src/kernel/context/Context.hpp diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index 60504fafd0..c501de891e 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -43,6 +43,8 @@ protected: class XBT_PUBLIC Context { friend ContextFactory; + static thread_local Context* current_; + std::function code_; actor::ActorImpl* actor_ = nullptr; void declare_context(std::size_t size); @@ -65,9 +67,9 @@ public: // 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 {