Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Replace sprintf by snprintf.
[simgrid.git] / src / simix / Context.cpp
index 4c478a2..d397833 100644 (file)
@@ -14,8 +14,7 @@
 
 #include "mc/mc.h"
 
-#include <src/simix/smx_private.h>
-#include <src/simix/smx_private.hpp>
+#include "src/simix/smx_private.h"
 
 void SIMIX_process_set_cleanup_function(
   smx_process_t process, void_pfn_smxprocess_t cleanup)
@@ -29,17 +28,16 @@ void SIMIX_process_set_cleanup_function(
  * \param argc the number of arguments of the main function
  * \param argv the vector of arguments of the main function
  * \param cleanup_func the function to call when the context stops
- * \param cleanup_arg the argument of the cleanup_func function
  */
 smx_context_t SIMIX_context_new(
-  xbt_main_func_t code, int argc, char **argv,
+  std::function<void()> code,
   void_pfn_smxprocess_t cleanup_func,
   smx_process_t simix_process)
 {
   if (!simix_global)
     xbt_die("simix is not initialized, please call MSG_init first");
   return simix_global->context_factory->create_context(
-    simgrid::simix::wrap_main(code, argc, argv), cleanup_func, simix_process);
+    std::move(code), cleanup_func, simix_process);
 }
 
 namespace simgrid {
@@ -56,7 +54,7 @@ Context* ContextFactory::self()
 
 void ContextFactory::declare_context(void* context, std::size_t size)
 {
-#ifdef HAVE_MC
+#if HAVE_MC
   /* Store the address of the stack in heap to compare it apart of heap comparison */
   if(MC_is_active())
     MC_ignore_heap(context, size);
@@ -108,4 +106,4 @@ AttachContext::~AttachContext()
 }
 
 }
-}
\ No newline at end of file
+}