From: Arnaud Giersch Date: Thu, 18 Apr 2019 11:30:28 +0000 (+0200) Subject: Revert "Inline Context::self()." X-Git-Tag: v3.22.2~102 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/56f88f273939075ab766b7c8348ef35fa455ea0b Revert "Inline Context::self()." This reverts commit 92061e0bc62b9a2ef3bdc041e5e9fe716ada1120. It's failing on appveyor (mingw64) with: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin\g++.exe -g3 -O3 -funroll-loops -fno-strict-aliasing -finline-functions -fdebug-prefix-map=C:/projects/simgrid=. -static-libgcc -static-libstdc++ -Wl,--add-stdcall-alias -m64 -shared -o lib\libsimgrid-java.dll -Wl,--out-implib,lib\libsimgrid-java.dll.a -Wl,--major-image-version,3,--minor-image-version,22 -Wl,--whole-archive CMakeFiles\simgrid-java.dir/objects.a -Wl,--no-whole-archive @CMakeFiles\simgrid-java.dir\linklibs.rsp CMakeFiles\simgrid-java.dir/objects.a(jmsg.cpp.obj):././src/bindings/java/jmsg.cpp:342: undefined reference to `__imp__ZTHN7simgrid6kernel7context7Context8current_E' CMakeFiles\simgrid-java.dir/objects.a(jmsg.cpp.obj):././src/bindings/java/jmsg.cpp:342: undefined reference to `__imp__ZTHN7simgrid6kernel7context7Context8current_E' CMakeFiles\simgrid-java.dir/objects.a(jmsg.cpp.obj):././src/bindings/java/jmsg.cpp:342: undefined reference to `__imp__ZTHN7simgrid6kernel7context7Context8current_E' CMakeFiles\simgrid-java.dir/objects.a(JavaContext.cpp.obj):././src/bindings/java/JavaContext.cpp:81: undefined reference to `__imp__ZTHN7simgrid6kernel7context7Context8current_E' collect2.exe: error: ld returned 1 exit status --- diff --git a/src/kernel/context/Context.cpp b/src/kernel/context/Context.cpp index 37ef379473..145e1e1cfe 100644 --- a/src/kernel/context/Context.cpp +++ b/src/kernel/context/Context.cpp @@ -22,7 +22,15 @@ ContextFactoryInitializer factory_initializer = nullptr; ContextFactory::~ContextFactory() = default; -thread_local Context* Context::current_ = nullptr; +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; +} void Context::declare_context(std::size_t size) { diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index c501de891e..60504fafd0 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -43,8 +43,6 @@ 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); @@ -67,9 +65,9 @@ public: // Retrieving the self() context /** @brief Retrives the current context of this thread */ - static Context* self() { return current_; } + static Context* self(); /** @brief Sets the current context of this thread */ - static void set_current(Context* self) { current_ = self; } + static void set_current(Context* self); }; class XBT_PUBLIC AttachContext : public Context {