Rev 1416 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1416 | Rev 1502 | ||
---|---|---|---|
Line 72... | Line 72... | ||
72 | /** Wait for the condition becoming true. |
72 | /** Wait for the condition becoming true. |
73 | * |
73 | * |
74 | * @param cv Condition variable. |
74 | * @param cv Condition variable. |
75 | * @param mtx Mutex. |
75 | * @param mtx Mutex. |
76 | * @param usec Timeout value in microseconds. |
76 | * @param usec Timeout value in microseconds. |
- | 77 | * @param flags Select mode of operation. |
|
77 | * |
78 | * |
78 | * For exact description of meaning of possible values of usec, |
79 | * For exact description of meaning of possible combinations |
79 | * see comment for waitq_sleep_timeout(). |
80 | * of usec and flags, see comment for waitq_sleep_timeout(). |
- | 81 | * Note that when SYNCH_FLAGS_NON_BLOCKING is specified here, |
|
- | 82 | * ESYNCH_WOULD_BLOCK is always returned. |
|
80 | * |
83 | * |
81 | * @return See comment for waitq_sleep_timeout(). |
84 | * @return See comment for waitq_sleep_timeout(). |
82 | */ |
85 | */ |
83 | int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec) |
86 | int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int flags) |
84 | { |
87 | { |
85 | int rc; |
88 | int rc; |
86 | ipl_t ipl; |
89 | ipl_t ipl; |
87 | 90 | ||
88 | ipl = waitq_sleep_prepare(&cv->wq); |
91 | ipl = waitq_sleep_prepare(&cv->wq); |
89 | mutex_unlock(mtx); |
92 | mutex_unlock(mtx); |
90 | 93 | ||
91 | cv->wq.missed_wakeups = 0; /* Enforce blocking. */ |
94 | cv->wq.missed_wakeups = 0; /* Enforce blocking. */ |
92 | rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, SYNCH_BLOCKING); |
95 | rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, flags); |
93 | 96 | ||
94 | mutex_lock(mtx); |
97 | mutex_lock(mtx); |
95 | waitq_sleep_finish(&cv->wq, rc, ipl); |
98 | waitq_sleep_finish(&cv->wq, rc, ipl); |
96 | 99 | ||
97 | return rc; |
100 | return rc; |