Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simix] Attach context
[simgrid.git] / include / simgrid / simix.h
index bd12391..984f1c4 100644 (file)
@@ -174,6 +174,11 @@ XBT_PUBLIC(int) SIMIX_is_maestro();
 /* Initialization and exit */
 XBT_PUBLIC(void) SIMIX_global_init(int *argc, char **argv);
 
+/* Set to execute in the maestro
+ *
+ * If no maestro code is registered (the default), the main thread
+ * is assumed to be the maestro. */
+XBT_PUBLIC(void) SIMIX_set_maestro(void (*code)(void*), void* data);
 
 XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t function);
 XBT_PUBLIC(void) SIMIX_function_register_process_create(smx_creation_func_t function);
@@ -210,6 +215,24 @@ XBT_PUBLIC(void) SIMIX_process_set_function(const char* process_host,
                                             double process_start_time,
                                             double process_kill_time);
 
+/*********************************** Host *************************************/
+/* Functions for running a process in main()
+ *
+ *  1. create the maestro process
+ *  2. attach (create a context and wait for maestro to give control back to you)
+ *  3. do you process job
+ *  4. detach (this waits for the simulation to terminate)
+ */
+
+XBT_PUBLIC(void) SIMIX_maestro_create(void (*code)(void*), void* data);
+XBT_PUBLIC(smx_process_t) SIMIX_process_attach(
+  const char* name,
+  void *data,
+  const char* hostname,
+  xbt_dict_t properties,
+  smx_process_t parent_process);
+XBT_PUBLIC(void) SIMIX_process_detach(void);
+
 /*********************************** Host *************************************/
 XBT_PUBLIC(sg_host_t) SIMIX_host_self(void);
 XBT_PUBLIC(const char*) SIMIX_host_self_get_name(void);