Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simix] Add assertion in run_kernel
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 4 Jan 2016 13:34:53 +0000 (14:34 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Mon, 4 Jan 2016 13:54:53 +0000 (14:54 +0100)
include/simgrid/simix.h
include/simgrid/simix.hpp
src/simix/smx_global.cpp

index 2c8bdf4..0e3117d 100644 (file)
@@ -167,7 +167,7 @@ XBT_PUBLIC(int) SIMIX_context_get_parallel_threshold(void);
 XBT_PUBLIC(void) SIMIX_context_set_parallel_threshold(int threshold);
 XBT_PUBLIC(e_xbt_parmap_mode_t) SIMIX_context_get_parallel_mode(void);
 XBT_PUBLIC(void) SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
 XBT_PUBLIC(void) SIMIX_context_set_parallel_threshold(int threshold);
 XBT_PUBLIC(e_xbt_parmap_mode_t) SIMIX_context_get_parallel_mode(void);
 XBT_PUBLIC(void) SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
-
+XBT_PUBLIC(int) SIMIX_is_maestro();
 
 
 /********************************** Global ************************************/
 
 
 /********************************** Global ************************************/
index 0cdf6ea..8dc1083 100644 (file)
@@ -55,6 +55,7 @@ typename std::result_of<F()>::type kernel(F&& code)
   typedef typename std::result_of<F()>::type R;
   std::promise<R> promise;
   simcall_run_kernel([&]{
   typedef typename std::result_of<F()>::type R;
   std::promise<R> promise;
   simcall_run_kernel([&]{
+    xbt_assert(SIMIX_is_maestro(), "Not in maestro");
     fulfill_promise(promise, code);
   });
   return promise.get_future().get();
     fulfill_promise(promise, code);
   });
   return promise.get_future().get();
index 3ba0e93..1da0f27 100644 (file)
@@ -698,3 +698,8 @@ xbt_dict_t SIMIX_asr_get_properties(const char *name)
 {
   return (xbt_dict_t) xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL);
 }
 {
   return (xbt_dict_t) xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL);
 }
+
+int SIMIX_is_maestro()
+{
+  return SIMIX_process_self() == simix_global->maestro_process;
+}
\ No newline at end of file