+
+ while ((process = xbt_swag_extract(simix_global->process_to_destroy))) {
+ SIMIX_context_free(process->context);
+
+ /* Free the exception allocated at creation time */
+ if (process->running_ctx)
+ free(process->running_ctx);
+ if (process->properties)
+ xbt_dict_free(&process->properties);
+
+ free(process->name);
+ process->name = NULL;
+ free(process);
+ }
+}
+
+/**
+ * \brief Creates and runs the maestro process
+ */
+void SIMIX_create_maestro_process()
+{
+ smx_process_t maestro = NULL;
+
+ /* Create maestro process and intilialize it */
+ maestro = xbt_new0(s_smx_process_t, 1);
+ maestro->pid = simix_process_maxpid++;
+ maestro->name = (char *) "";
+ maestro->running_ctx = xbt_new(xbt_running_ctx_t, 1);
+ XBT_RUNNING_CTX_INITIALIZE(maestro->running_ctx);
+ maestro->context = SIMIX_context_new(NULL, 0, NULL, NULL, maestro);
+ maestro->request.issuer = maestro;
+
+ simix_global->maestro_process = maestro;
+ return;
+}
+
+/**
+ * \brief Same as SIMIX_process_create() but with only one argument (used by timers).
+ * \return the process created
+ */
+smx_process_t SIMIX_process_create_from_wrapper(smx_process_arg_t args) {
+
+ smx_process_t process;
+ simix_global->create_process_function(
+ &process,
+ args->name,
+ args->code,
+ args->data,
+ args->hostname,
+ args->argc,
+ args->argv,
+ args->properties);
+
+ return process;
+}
+
+/**
+ * \brief Internal function to create a process.
+ *
+ * This function actually creates the process.
+ * It may be called when a REQ_PROCESS_CREATE request occurs,
+ * or directly for SIMIX internal purposes.
+ *
+ * \return the process created
+ */
+void SIMIX_process_create(smx_process_t *process,
+ const char *name,
+ xbt_main_func_t code,
+ void *data,
+ const char *hostname,
+ int argc, char **argv,
+ xbt_dict_t properties) {
+
+ *process = NULL;