/kernel/trunk/generic/include/synch/condvar.h |
---|
39,15 → 39,13 |
}; |
#define condvar_wait(cv,mtx) \ |
_condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING) |
#define condvar_trywait(cv,mtx) \ |
_condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING) |
_condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT) |
#define condvar_wait_timeout(cv,mtx,usec) \ |
_condvar_wait_timeout((cv),(mtx),(usec),SYNCH_NON_BLOCKING) |
_condvar_wait_timeout((cv),(mtx),(usec)) |
extern void condvar_initialize(condvar_t *cv); |
extern void condvar_signal(condvar_t *cv); |
extern void condvar_broadcast(condvar_t *cv); |
extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int trywait); |
extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec); |
#endif |
/kernel/trunk/generic/src/synch/condvar.c |
---|
74,14 → 74,13 |
* @param cv Condition variable. |
* @param mtx Mutex. |
* @param usec Timeout value in microseconds. |
* @param trywait Blocking versus non-blocking operation mode switch. |
* |
* For exact description of possible combinations of |
* usec and trywait, see comment for waitq_sleep_timeout(). |
* For exact description of meaning of possible values of usec, |
* see comment for waitq_sleep_timeout(). |
* |
* @return See comment for waitq_sleep_timeout(). |
*/ |
int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int trywait) |
int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec) |
{ |
int rc; |
ipl_t ipl; |
88,9 → 87,10 |
ipl = waitq_sleep_prepare(&cv->wq); |
mutex_unlock(mtx); |
rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, trywait); |
cv->wq.missed_wakeups = 0; /* Enforce blocking. */ |
rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, SYNCH_BLOCKING); |
mutex_lock(mtx); |
waitq_sleep_finish(&cv->wq, rc, ipl); |