]> AND Public Git Repository - simgrid.git/blobdiff - src/kernel/context/Context.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'Adrien.Gougeon/simgrid-master'
[simgrid.git] / src / kernel / context / Context.hpp
index f1aa12bc48a92fa4798df2b2ee816a57639afd2e..dc747a1d26bb8016a44d46ec5e69b1e2e1f58808 100644 (file)
@@ -9,7 +9,6 @@
 #include "simgrid/forward.h"
 #include "src/kernel/activity/ActivityImpl.hpp"
 
-#include <array>
 #include <csignal>
 #include <functional>
 
@@ -44,12 +43,18 @@ protected:
 class XBT_PUBLIC Context {
   friend ContextFactory;
 
+  static thread_local Context* current_context_;
+
   std::function<void()> code_;
   actor::ActorImpl* actor_ = nullptr;
   bool iwannadie_          = false;
   void declare_context(std::size_t size);
 
 public:
+#ifndef WIN32
+  static int install_sigsegv_stack(stack_t* old_stack, bool enable);
+#endif
+
   Context(std::function<void()>&& code, actor::ActorImpl* actor);
   Context(const Context&) = delete;
   Context& operator=(const Context&) = delete;
@@ -90,7 +95,7 @@ public:
 
 
 /* This allows Java to hijack the context factory (Java induces factories of factory :) */
-typedef ContextFactory* (*ContextFactoryInitializer)();
+using ContextFactoryInitializer = ContextFactory* (*)();
 XBT_PUBLIC_DATA ContextFactoryInitializer factory_initializer;
 
 XBT_PRIVATE ContextFactory* thread_factory();
@@ -104,8 +109,4 @@ XBT_PRIVATE ContextFactory* boost_factory();
 
 XBT_PRIVATE void SIMIX_context_mod_init();
 XBT_PRIVATE void SIMIX_context_mod_exit();
-
-#ifndef WIN32
-XBT_PUBLIC_DATA std::array<unsigned char, SIGSTKSZ> sigsegv_stack;
-#endif
 #endif