Lines Matching refs:wq
36 glwthread_waitqueue_init (glwthread_waitqueue_t *wq) in glwthread_waitqueue_init() argument
38 wq->array = NULL; in glwthread_waitqueue_init()
39 wq->count = 0; in glwthread_waitqueue_init()
40 wq->alloc = 0; in glwthread_waitqueue_init()
41 wq->offset = 0; in glwthread_waitqueue_init()
47 glwthread_waitqueue_add (glwthread_waitqueue_t *wq) in glwthread_waitqueue_add() argument
52 if (wq->count == wq->alloc) in glwthread_waitqueue_add()
54 unsigned int new_alloc = 2 * wq->alloc + 1; in glwthread_waitqueue_add()
56 (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE)); in glwthread_waitqueue_add()
62 if (wq->offset > 0) in glwthread_waitqueue_add()
64 unsigned int old_count = wq->count; in glwthread_waitqueue_add()
65 unsigned int old_alloc = wq->alloc; in glwthread_waitqueue_add()
66 unsigned int old_offset = wq->offset; in glwthread_waitqueue_add()
76 wq->offset = 0; in glwthread_waitqueue_add()
78 wq->array = new_array; in glwthread_waitqueue_add()
79 wq->alloc = new_alloc; in glwthread_waitqueue_add()
87 index = wq->offset + wq->count; in glwthread_waitqueue_add()
88 if (index >= wq->alloc) in glwthread_waitqueue_add()
89 index -= wq->alloc; in glwthread_waitqueue_add()
90 wq->array[index] = event; in glwthread_waitqueue_add()
91 wq->count++; in glwthread_waitqueue_add()
97 glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq) in glwthread_waitqueue_notify_first() argument
99 SetEvent (wq->array[wq->offset + 0]); in glwthread_waitqueue_notify_first()
100 wq->offset++; in glwthread_waitqueue_notify_first()
101 wq->count--; in glwthread_waitqueue_notify_first()
102 if (wq->count == 0 || wq->offset == wq->alloc) in glwthread_waitqueue_notify_first()
103 wq->offset = 0; in glwthread_waitqueue_notify_first()
108 glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq) in glwthread_waitqueue_notify_all() argument
112 for (i = 0; i < wq->count; i++) in glwthread_waitqueue_notify_all()
114 unsigned int index = wq->offset + i; in glwthread_waitqueue_notify_all()
115 if (index >= wq->alloc) in glwthread_waitqueue_notify_all()
116 index -= wq->alloc; in glwthread_waitqueue_notify_all()
117 SetEvent (wq->array[index]); in glwthread_waitqueue_notify_all()
119 wq->count = 0; in glwthread_waitqueue_notify_all()
120 wq->offset = 0; in glwthread_waitqueue_notify_all()