Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1375 → Rev 1374

/kernel/trunk/generic/src/synch/condvar.c
35,11 → 35,11
#include <synch/mutex.h>
#include <synch/waitq.h>
#include <synch/synch.h>
#include <arch.h>
#include <typedefs.h>
 
/** Initialize condition variable.
/** Initialize condition variable
*
* Initialize condition variable.
*
* @param cv Condition variable.
*/
void condvar_initialize(condvar_t *cv)
47,7 → 47,8
waitq_initialize(&cv->wq);
}
 
/**
/** Signal the condition has become true
*
* Signal the condition has become true
* to the first waiting thread by waking it up.
*
58,7 → 59,8
waitq_wakeup(&cv->wq, WAKEUP_FIRST);
}
 
/**
/** Signal the condition has become true
*
* Signal the condition has become true
* to all waiting threads by waking them up.
*
69,8 → 71,10
waitq_wakeup(&cv->wq, WAKEUP_ALL);
}
 
/** Wait for the condition becoming true.
/** Wait for the condition becoming true
*
* Wait for the condition becoming true.
*
* @param cv Condition variable.
* @param mtx Mutex.
* @param usec Timeout value in microseconds.
84,15 → 88,9
int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int trywait)
{
int rc;
ipl_t ipl;
 
ipl = waitq_sleep_prepare(&cv->wq);
mutex_unlock(mtx);
rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, trywait);
 
rc = waitq_sleep_timeout(&cv->wq, usec, trywait);
mutex_lock(mtx);
waitq_sleep_finish(&cv->wq, rc, ipl);
 
return rc;
}