+ xbt_assert0((action != NULL)
+ && (action->simdata != NULL), "Invalid parameter");
+
+ surf_workstation_model->common_public->set_priority(action->simdata->
+ surf_action, priority);
+ return;
+}
+
+/**
+ * \brief Destroys an action
+ *
+ * Destroys an action, freing its memory. This function cannot be called if there are a conditional waiting for it.
+ * \param action The SIMIX action
+ */
+int SIMIX_action_destroy(smx_action_t action)
+{
+ XBT_IN3("(%p:'%s',%d)", action, action->name, action->refcount);
+ xbt_assert0((action != NULL), "Invalid parameter");
+
+ action->refcount--;
+ if (action->refcount > 0)
+ return 0;
+
+ xbt_assert1((xbt_fifo_size(action->cond_list) == 0),
+ "Conditional list not empty %d. There is a problem. Cannot destroy it now!",
+ xbt_fifo_size(action->cond_list));
+
+ DEBUG1("Destroy action %p", action);
+ if (action->name)
+ xbt_free(action->name);
+
+ xbt_fifo_free(action->cond_list);
+
+ if (action->simdata->surf_action)
+ action->simdata->surf_action->model_type->
+ common_public->action_free(action->simdata->surf_action);
+
+ xbt_free(action->simdata);
+ xbt_free(action);
+ return 1;
+}
+
+/**
+ * \brief Increase refcount of anan action
+ *
+ * \param action The SIMIX action
+ */
+void SIMIX_action_use(smx_action_t action)
+{
+ XBT_IN3("(%p:'%s',%d)", action, action->name, action->refcount);
+ xbt_assert0((action != NULL), "Invalid parameter");
+
+ action->refcount++;
+
+ return;
+}
+
+/**
+ * \brief Decrease refcount of anan action
+ *
+ * \param action The SIMIX action
+ */
+void SIMIX_action_release(smx_action_t action)
+{
+ xbt_assert0((action != NULL), "Invalid parameter");
+
+ action->refcount--;
+
+ return;
+}
+
+/**
+ * \brief Set an action to a condition
+ *
+ * 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_action_to_condition(smx_action_t action, smx_cond_t cond)
+{
+ xbt_assert0((action != NULL) && (cond != NULL), "Invalid parameters");
+
+ DEBUG2("Register action %p to cond %p", action, cond);
+ __SIMIX_cond_display_actions(cond);
+ xbt_fifo_push(cond->actions, action);
+ __SIMIX_cond_display_actions(cond);
+ DEBUG2("Register condition %p to action %p", cond, action);
+ __SIMIX_action_display_conditions(action);
+ xbt_fifo_push(action->cond_list, cond);
+ __SIMIX_action_display_conditions(action);
+}
+
+/**
+ * \brief Unset an action to a condition.
+ *
+ * Destroys the "links" from the condition to this action.
+ * \param action SIMIX action
+ * \param cond SIMIX cond
+ */
+void SIMIX_unregister_action_to_condition(smx_action_t action,
+ smx_cond_t cond)
+{
+ xbt_assert0((action != NULL) && (cond != NULL), "Invalid parameters");
+
+ __SIMIX_cond_display_actions(cond);
+ xbt_fifo_remove_all(cond->actions, action);
+ __SIMIX_cond_display_actions(cond);
+ __SIMIX_action_display_conditions(action);
+ xbt_fifo_remove_all(action->cond_list, cond);
+ __SIMIX_action_display_conditions(action);