Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #2 from mquinson/master
[simgrid.git] / src / simix / smx_private.hpp
index a0d704a..255105f 100644 (file)
@@ -9,25 +9,7 @@
 
 #include <simgrid/simix.hpp>
 #include "smx_private.h"
-
-/**
- * \brief creates a new context for a user level process
- * \param code a main 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
- */
-static inline smx_context_t SIMIX_context_new(xbt_main_func_t code,
-                                                  int argc, char **argv,
-                                                  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(
-    code, argc, argv, cleanup_func, simix_process);
-}
+#include "src/simix/popping_private.h"
 
 /**
  * \brief destroy a context
@@ -96,6 +78,15 @@ XBT_PRIVATE ContextFactory* sysv_factory();
 XBT_PRIVATE ContextFactory* raw_factory();
 XBT_PRIVATE ContextFactory* boost_factory();
 
+template<class R, class... Args> inline
+R simcall(e_smx_simcall_t call, Args&&... args)
+{
+  smx_process_t self = SIMIX_process_self();
+  marshal(&self->simcall, call, std::forward<Args>(args)...);
+  simcall_call(self);
+  return unmarshal<R>(self->simcall.result);
+}
+
 }
 }