- DEBUG1("Destroy condition %p",cond);
- 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;
- }
-}
-
-/**
- * \brief Set a condition to an action
- *
- * Creates the "link" between an action and a condition. You have to call this function when you create an action and want to wait its ending.
- * \param action SIMIX action
- * \param cond SIMIX cond
- */
-void SIMIX_register_condition_to_action(smx_action_t action, smx_cond_t cond)
-{
- xbt_assert0( (action != NULL) && (cond != NULL), "Invalid parameters");
-
- DEBUG2("Register condition %p to action %p",cond,action);
- xbt_fifo_push(action->cond_list,cond);
+ DEBUG1("Destroy condition %p", cond);
+ 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);
+
+ DEBUG1("%d actions registered", xbt_fifo_size(cond->actions));
+ __SIMIX_cond_display_actions(cond);
+ xbt_fifo_foreach(cond->actions, item, action, smx_action_t) {
+ SIMIX_unregister_action_to_condition(action, cond);
+ }
+ __SIMIX_cond_display_actions(cond);
+
+ xbt_fifo_free(cond->actions);
+ xbt_free(cond);
+ return;
+ }