Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make sthread work out of MC build trees
[simgrid.git] / src / xbt / xbt_main.cpp
index 41ae101..6086dad 100644 (file)
@@ -10,6 +10,7 @@
 #include "simgrid/config.h"
 #include "simgrid/sg_config.hpp"
 #include "src/internal_config.h"
+#include "src/sthread/sthread.h" // sthread_inside_simgrid
 #include "xbt/config.hpp"
 #include "xbt/coverage.h"
 #include "xbt/dynar.h"
@@ -35,12 +36,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module, xbt, "module handling");
 
 XBT_LOG_NEW_CATEGORY(smpi, "All SMPI categories"); /* lives here even if that's a bit odd to solve linking issues: this is used in xbt_log_file_appender to detect whether SMPI is used (and thus whether we should unbench the writing to disk) */
 
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
 std::string binary_name;          /* Name of the system process containing us (mandatory to retrieve neat backtraces) */
 std::vector<std::string> cmdline; /* all we got in argv */
-} // namespace xbt
-} // namespace simgrid
+} // namespace simgrid::xbt
+
+volatile int sthread_inside_simgrid = 1; // Only intercept pthread calls in user code.
 
 int xbt_initialized = 0;
 simgrid::config::Flag<bool> cfg_dbg_clean_atexit{
@@ -159,3 +160,10 @@ void xbt_abort()
 #endif
   abort();
 }
+
+#ifndef HAVE_SMPI
+int SMPI_is_inited()
+{
+  return false;
+}
+#endif
\ No newline at end of file