XBT_PUBLIC(void) SIMIX_cond_broadcast(smx_cond_t cond);
XBT_PUBLIC(void) SIMIX_cond_destroy(smx_cond_t cond);
XBT_PUBLIC(void) SIMIX_register_condition_to_action(smx_action_t action, smx_cond_t cond);
+XBT_PUBLIC(void) SIMIX_unregister_condition_to_action(smx_action_t action, smx_cond_t cond);
XBT_PUBLIC(xbt_fifo_t) SIMIX_cond_get_actions(smx_cond_t cond);
DEBUG2("Killing process %s on %s",process->name, p_simdata->s_host->name);
/* Cleanup if we were waiting for something */
+ DEBUG0("Here!");
if (p_simdata->mutex)
xbt_swag_remove(process,p_simdata->mutex->sleeping);
+ DEBUG0("Here!");
if (p_simdata->cond)
xbt_swag_remove(process,p_simdata->cond->sleeping);
+ DEBUG0("Here!");
xbt_swag_remove(process, simix_global->process_to_run);
+ DEBUG0("Here!");
xbt_swag_remove(process, simix_global->process_list);
+ DEBUG2("%p here! killing %p",simix_global->current_process,process);
xbt_context_kill(process->simdata->context);
+ DEBUG0("Here!");
if(process==SIMIX_process_self()) {
/* I just killed myself */
+ DEBUG0("Here!");
xbt_context_yield();
}
+ DEBUG0("Here!");
}
/**
if ( cond == NULL )
return ;
else {
+ xbt_fifo_item_t item = NULL;
+ smx_action_t action = NULL;
+
xbt_assert0( xbt_swag_size(cond->sleeping) == 0 , "Cannot destroy conditional since someone is still using it");
xbt_swag_free(cond->sleeping);
+
+ xbt_fifo_foreach(cond->actions,item,action,smx_action_t) {
+ SIMIX_unregister_condition_to_action(action, cond);
+ }
xbt_fifo_free(cond->actions);
xbt_free(cond);
return;
xbt_fifo_push(action->cond_list,cond);
}
+/**
+ * \brief Unset a condition to an action
+ *
+ * Destroys the "link" between an action and a condition.
+ * \param action SIMIX action
+ * \param cond SIMIX cond
+ */
+void SIMIX_unregister_condition_to_action(smx_action_t action, smx_cond_t cond)
+{
+ xbt_assert0( (action != NULL) && (cond != NULL), "Invalid parameters");
+
+ while(xbt_fifo_remove(action->cond_list,cond)) {}
+}
+
+