Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "Inline Context::self()."
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 18 Apr 2019 11:30:28 +0000 (13:30 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 18 Apr 2019 11:30:28 +0000 (13:30 +0200)
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

src/kernel/context/Context.cpp
src/kernel/context/Context.hpp

index 37ef379..145e1e1 100644 (file)
@@ -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)
 {
index c501de8..60504fa 100644 (file)
@@ -43,8 +43,6 @@ protected:
 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);
@@ -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 {