Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ctx: move some bits to a private header and reduce the exposure of src/internal_config.h
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 20 Jan 2019 21:55:40 +0000 (22:55 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 20 Jan 2019 21:56:17 +0000 (22:56 +0100)
src/kernel/context/Context.hpp
src/kernel/context/ContextThread.cpp
src/kernel/context/ContextUnix.cpp
src/kernel/context/context_private.hpp

index 50fc40b..6543800 100644 (file)
@@ -7,7 +7,6 @@
 #define SIMGRID_KERNEL_CONTEXT_CONTEXT_HPP
 
 #include "simgrid/forward.h"
 #define SIMGRID_KERNEL_CONTEXT_CONTEXT_HPP
 
 #include "simgrid/forward.h"
-#include "src/internal_config.h"
 #include "src/kernel/activity/ActivityImpl.hpp"
 
 #include <csignal>
 #include "src/kernel/activity/ActivityImpl.hpp"
 
 #include <csignal>
@@ -130,16 +129,6 @@ XBT_PUBLIC smx_context_t SIMIX_context_new(std::function<void()> code, void_pfn_
 XBT_PUBLIC_DATA char sigsegv_stack[SIGSTKSZ];
 #endif
 
 XBT_PUBLIC_DATA char sigsegv_stack[SIGSTKSZ];
 #endif
 
-/* We are using the bottom of the stack to save some information, like the
- * valgrind_stack_id. Define smx_context_usable_stack_size to give the remaining
- * size for the stack. Round its value to a multiple of 16 (asan wants the stacks to be aligned this way). */
-#if HAVE_VALGRIND_H
-#define smx_context_usable_stack_size                                                                                  \
-  ((smx_context_stack_size - sizeof(unsigned int)) & ~0xf) /* for valgrind_stack_id */
-#else
-#define smx_context_usable_stack_size (smx_context_stack_size & ~0xf)
-#endif
-
 /** @brief Executes all the processes to run (in parallel if possible). */
 XBT_PRIVATE void SIMIX_context_runall();
 
 /** @brief Executes all the processes to run (in parallel if possible). */
 XBT_PRIVATE void SIMIX_context_runall();
 
index 9949353..2037673 100644 (file)
@@ -75,9 +75,10 @@ ThreadContext::ThreadContext(std::function<void()> code, void_pfn_smxprocess_t c
 
 ThreadContext::~ThreadContext()
 {
 
 ThreadContext::~ThreadContext()
 {
-  if (this->thread_) /* If there is a thread (maestro don't have any), wait for its termination */
+  if (this->thread_) { /* Maestro don't have any thread */
     thread_->join();
     thread_->join();
-  delete thread_;
+    delete thread_;
+  }
 }
 
 void *ThreadContext::wrapper(void *param)
 }
 
 void *ThreadContext::wrapper(void *param)
index ba5ed9a..e9dafbf 100644 (file)
@@ -26,6 +26,7 @@ static_assert(sizeof(simgrid::kernel::context::UContext*) <= CTX_ADDR_LEN * size
 namespace simgrid {
 namespace kernel {
 namespace context {
 namespace simgrid {
 namespace kernel {
 namespace context {
+
 // The name of this function is currently hardcoded in MC (as string).
 // Do not change it without fixing those references as well.
 static void smx_ctx_wrapper(int i1, int i2)
 // The name of this function is currently hardcoded in MC (as string).
 // Do not change it without fixing those references as well.
 static void smx_ctx_wrapper(int i1, int i2)
index 8a47f56..0bf2a78 100644 (file)
 #define ASAN_FINISH_SWITCH(fake_stack_save, bottom_old, size_old) (void)0
 #endif
 
 #define ASAN_FINISH_SWITCH(fake_stack_save, bottom_old, size_old) (void)0
 #endif
 
+/* We are using the bottom of the stack to save some information, like the
+ * valgrind_stack_id. Define smx_context_usable_stack_size to give the remaining
+ * size for the stack. Round its value to a multiple of 16 (asan wants the stacks to be aligned this way). */
+#if HAVE_VALGRIND_H
+#define smx_context_usable_stack_size                                                                                  \
+  ((smx_context_stack_size - sizeof(unsigned int)) & ~0xf) /* for valgrind_stack_id */
+#else
+#define smx_context_usable_stack_size (smx_context_stack_size & ~0xf)
+#endif
+
 #endif
 #endif