+ smx_process_t self = SIMIX_process_self();
+
+ xbt_assert0((mutex != NULL), "Invalid parameters");
+
+ /* process status */
+ self->simdata->cond = cond;
+
+ xbt_swag_insert(self, cond->sleeping);
+ cond->mutex = mutex;
+
+ SIMIX_mutex_unlock(mutex);
+ /* if the max_duration < 0, blocks forever */
+ if (max_duration >=0) {
+ __SIMIX_process_block(max_duration);
+ self->simdata->cond = NULL;
+ }
+ else {
+ __SIMIX_process_block(-1);
+ self->simdata->cond = NULL;
+ }
+ /* get the mutex again */
+ SIMIX_mutex_lock(cond->mutex);