+ xbt_assert0((action != NULL) && (cond != NULL), "Invalid parameters");
+
+ DEBUG2("Register action %p to cond %p", action, cond);
+ if(XBT_LOG_ISENABLED(simix_action, xbt_log_priority_debug))
+ __SIMIX_cond_display_actions(cond);
+
+ xbt_fifo_push(cond->actions, action);
+
+ if(XBT_LOG_ISENABLED(simix_action, xbt_log_priority_debug))
+ __SIMIX_cond_display_actions(cond);
+
+ DEBUG2("Register condition %p to action %p", cond, action);
+
+ if(XBT_LOG_ISENABLED(simix_action, xbt_log_priority_debug))
+ __SIMIX_action_display_conditions(action);
+
+ xbt_fifo_push(action->cond_list, cond);
+
+ if(XBT_LOG_ISENABLED(simix_action, xbt_log_priority_debug))
+ __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");
+
+ if(XBT_LOG_ISENABLED(simix_action, xbt_log_priority_debug))
+ __SIMIX_cond_display_actions(cond);
+
+ xbt_fifo_remove_all(cond->actions, action);
+
+ if(XBT_LOG_ISENABLED(simix_action, xbt_log_priority_debug))
+ __SIMIX_cond_display_actions(cond);
+
+ if(XBT_LOG_ISENABLED(simix_action, xbt_log_priority_debug))
+ __SIMIX_action_display_conditions(action);
+
+ xbt_fifo_remove_all(action->cond_list, cond);
+
+ if(XBT_LOG_ISENABLED(simix_action, xbt_log_priority_debug))
+ __SIMIX_action_display_conditions(action);
+}
+/**
+ * \brief Link an action to a semaphore
+ *
+ * When the action terminates, the semaphore gets signaled automatically.
+ */
+void SIMIX_register_action_to_semaphore(smx_action_t action, smx_sem_t sem) {
+
+ DEBUG2("Register action %p to semaphore %p (and otherwise)", action, sem);
+ xbt_fifo_push(sem->actions, action);
+ xbt_fifo_push(action->sem_list, sem);
+}
+/**
+ * \brief Unset an action to a semaphore.
+ *
+ * Destroys the "links" from the semaphore to this action.
+ */
+void SIMIX_unregister_action_to_semaphore(smx_action_t action,
+ smx_sem_t sem)
+{
+ xbt_fifo_remove_all(sem->actions, action);
+ xbt_fifo_remove_all(action->sem_list, sem);
+}
+
+/**
+ * \brief Return how much remais to be done in the action.
+ *
+ * \param action The SIMIX action
+ * \return Remains cost
+ */
+double SIMIX_action_get_remains(smx_action_t action)
+{
+ xbt_assert0((action != NULL), "Invalid parameter");
+ return surf_workstation_model->get_remains(action->surf_action);
+}
+
+smx_action_t SIMIX_action_parallel_execute(char *name, int host_nb,
+ smx_host_t * host_list,
+ double *computation_amount,
+ double *communication_amount,
+ double amount, double rate)
+{
+ void **workstation_list = NULL;
+ smx_action_t act;
+ int i;
+
+ /* alloc structures */
+ act = xbt_new0(s_smx_action_t, 1);
+ act->cond_list = xbt_fifo_new();
+ act->sem_list = xbt_fifo_new();
+
+ /* initialize them */
+ act->name = xbt_strdup(name);
+
+ /* set action */
+
+ workstation_list = xbt_new0(void *, host_nb);
+ for (i = 0; i < host_nb; i++)
+ workstation_list[i] = host_list[i]->host;
+
+ act->surf_action =
+ surf_workstation_model->extension.workstation.
+ execute_parallel_task(host_nb, workstation_list, computation_amount,
+ communication_amount, amount, rate);
+
+ surf_workstation_model->action_data_set(act->surf_action, act);
+
+ return act;
+}
+
+e_surf_action_state_t SIMIX_action_get_state(smx_action_t action)
+{
+ xbt_assert0((action != NULL), "Invalid parameter");
+ return surf_workstation_model->action_state_get(action->surf_action);
+}