+void SIMIX_pre_cond_signal(smx_simcall_t simcall, smx_cond_t cond){
+ SIMIX_cond_signal(cond);
+}
+/**
+ * \brief Signalizes a condition.
+ *
+ * Signalizes a condition and wakes up a sleeping process.
+ * If there are no process sleeping, no action is done.
+ * \param cond A condition
+ */
+void SIMIX_cond_signal(smx_cond_t cond)
+{
+ XBT_IN("(%p)",cond);
+ smx_process_t proc = NULL;
+ smx_mutex_t mutex = NULL;
+ smx_simcall_t simcall = NULL;
+
+ XBT_DEBUG("Signal condition %p", cond);
+
+ /* If there are processes waiting for the condition choose one and try
+ to make it acquire the mutex */
+ if ((proc = xbt_swag_extract(cond->sleeping))) {
+
+ /* Destroy waiter's synchro action */
+ SIMIX_synchro_destroy(proc->waiting_action);
+ proc->waiting_action = NULL;
+
+ /* Now transform the cond wait simcall into a mutex lock one */
+ simcall = &proc->simcall;
+ if(simcall->call == SIMCALL_COND_WAIT)
+ mutex = simcall_cond_wait__get__mutex(simcall);
+ else
+ mutex = simcall_cond_wait_timeout__get__mutex(simcall);
+ simcall->call = SIMCALL_MUTEX_LOCK;
+
+ SIMIX_pre_mutex_lock(simcall, mutex);
+ }
+ XBT_OUT();
+}
+
+void SIMIX_pre_cond_broadcast(smx_simcall_t simcall, smx_cond_t cond){
+ SIMIX_cond_broadcast(cond);
+}
+/**
+ * \brief Broadcasts a condition.
+ *
+ * Signal ALL processes waiting on a condition.
+ * If there are no process waiting, no action is done.
+ * \param cond A condition
+ */