simix_global->mutex = NULL;
/* Let's free maestro now */
- SIMIX_context_free(simix_global->maestro_process->context);
+ delete simix_global->maestro_process->context;
xbt_free(simix_global->maestro_process->running_ctx);
xbt_free(simix_global->maestro_process);
simix_global->maestro_process = NULL;
#include "smx_private.h"
#include "src/simix/popping_private.h"
-/**
- * \brief destroy a context
- * \param context the context to destroy
- * Argument must be stopped first -- runs in maestro context
- */
-static inline void SIMIX_context_free(smx_context_t context)
-{
- delete context;
-}
-
-/**
- * \brief stops the execution of a context
- * \param context to stop
- */
-static inline void SIMIX_context_stop(smx_context_t context)
-{
- context->stop();
-}
-
-/**
- \brief suspends a context and return the control back to the one which
- scheduled it
- \param context the context to be suspended (it must be the running one)
- */
-static inline void SIMIX_context_suspend(smx_context_t context)
-{
- context->suspend();
-}
-
-/**
- \brief Executes all the processes to run (in parallel if possible).
- */
+/** @brief Executes all the processes to run (in parallel if possible). */
static inline void SIMIX_context_runall(void)
{
if (!xbt_dynar_is_empty(simix_global->process_to_run))
simix_global->context_factory->run_all();
}
-/**
- \brief returns the current running context
- */
+/** @brief returns the current running context */
static inline smx_context_t SIMIX_context_self(void)
{
if (simix_global && simix_global->context_factory)
while ((process = (smx_process_t) xbt_swag_extract(simix_global->process_to_destroy))) {
XBT_DEBUG("Getting rid of %p",process);
- SIMIX_context_free(process->context);
+ delete process->context;
/* Free the exception allocated at creation time */
free(process->running_ctx);
arg->auto_restart);
}
XBT_DEBUG("Process %s (%s) is dead",arg->name,sg_host_get_name(arg->host));
- /* stop the context */
- SIMIX_context_stop(arg->context);
+ arg->context->stop();
}
/**
XBT_DEBUG("Yield process '%s'", self->name);
/* Go into sleep and return control to maestro */
- SIMIX_context_suspend(self->context);
+ self->context->suspend();
/* Ok, maestro returned control to us */
XBT_DEBUG("Control returned to me: '%s'", self->name);
XBT_DEBUG("Worker %d has finished", data->worker_id);
/* We are destroying the parmap */
} else {
- SIMIX_context_free(context);
+ delete context;
xbt_free(data);
return NULL;
}