Lines Matching refs:cond
128 CONDITION_VARIABLE *cond = mm_malloc(sizeof(CONDITION_VARIABLE));
129 if (!cond)
131 InitializeConditionVariable_fn(cond);
132 return cond;
138 CONDITION_VARIABLE *cond = _cond;
140 mm_free(cond);
146 CONDITION_VARIABLE *cond = _cond;
148 WakeAllConditionVariable_fn(cond);
150 WakeConditionVariable_fn(cond);
157 CONDITION_VARIABLE *cond = _cond;
166 result = SleepConditionVariableCS_fn(cond, lock, ms);
190 struct evthread_win32_cond *cond;
191 if (!(cond = mm_malloc(sizeof(struct evthread_win32_cond))))
193 if (InitializeCriticalSectionAndSpinCount(&cond->lock, SPIN_COUNT)==0) {
194 mm_free(cond);
197 if ((cond->event = CreateEvent(NULL,TRUE,FALSE,NULL)) == NULL) {
198 DeleteCriticalSection(&cond->lock);
199 mm_free(cond);
202 cond->n_waiting = cond->n_to_wake = cond->generation = 0;
203 return cond;
209 struct evthread_win32_cond *cond = _cond;
210 DeleteCriticalSection(&cond->lock);
211 CloseHandle(cond->event);
212 mm_free(cond);
218 struct evthread_win32_cond *cond = _cond;
219 EnterCriticalSection(&cond->lock);
221 cond->n_to_wake = cond->n_waiting;
223 ++cond->n_to_wake;
224 cond->generation++;
225 SetEvent(cond->event);
226 LeaveCriticalSection(&cond->lock);
233 struct evthread_win32_cond *cond = _cond;
242 EnterCriticalSection(&cond->lock);
243 ++cond->n_waiting;
244 generation_at_start = cond->generation;
245 LeaveCriticalSection(&cond->lock);
252 res = WaitForSingleObject(cond->event, ms);
253 EnterCriticalSection(&cond->lock);
254 if (cond->n_to_wake &&
255 cond->generation != generation_at_start) {
256 --cond->n_to_wake;
257 --cond->n_waiting;
263 --cond->n_waiting;
270 --cond->n_waiting;
278 if (cond->n_to_wake == 0) {
281 ResetEvent(cond->event);
284 LeaveCriticalSection(&cond->lock);
289 EnterCriticalSection(&cond->lock);
290 if (!cond->n_waiting)
291 ResetEvent(cond->event);
292 LeaveCriticalSection(&cond->lock);