Lines Matching refs:w

134 	struct waiter *w;  in waiter_create()  local
136 w = calloc(1, sizeof(*w)); in waiter_create()
137 if (w == NULL) in waiter_create()
140 list_init(&w->tickets); in waiter_create()
141 return w; in waiter_create()
144 void waiter_destroy(struct waiter *w) in waiter_destroy() argument
150 list_for_each_safe(&w->tickets, node, safe) { in waiter_destroy()
155 if (w->pollset) in waiter_destroy()
156 pollset_destroy(w->pollset); in waiter_destroy()
157 free(w); in waiter_destroy()
160 void waiter_synchronize(struct waiter *w) in waiter_synchronize() argument
166 list_for_each(&w->tickets, node) { in waiter_synchronize()
186 void waiter_wait(struct waiter *w) in waiter_wait() argument
188 struct pollset *ps = w->pollset; in waiter_wait()
198 list_for_each(&w->tickets, node) { in waiter_wait()
233 list_for_each(&w->tickets, node) { in waiter_wait()
264 int waiter_wait_timeout(struct waiter *w, unsigned int ms) in waiter_wait_timeout() argument
271 list_append(&w->tickets, &ticket.list_item); in waiter_wait_timeout()
272 w->count++; in waiter_wait_timeout()
274 waiter_wait(w); in waiter_wait_timeout()
277 list_remove(&w->tickets, &ticket.list_item); in waiter_wait_timeout()
278 w->count--; in waiter_wait_timeout()
301 struct waiter_ticket *waiter_add_null(struct waiter *w) in waiter_add_null() argument
308 ticket->waiter = w; in waiter_add_null()
310 list_append(&w->tickets, &ticket->list_item); in waiter_add_null()
311 if ((w->count % 32) == 0) { in waiter_add_null()
312 if (w->pollset) in waiter_add_null()
313 pollset_destroy(w->pollset); in waiter_add_null()
314 w->pollset = pollset_create(w->count + 33); in waiter_add_null()
315 if (w->pollset == NULL) in waiter_add_null()
318 w->count++; in waiter_add_null()
325 struct waiter_ticket *waiter_add_fd(struct waiter *w, int fd) in waiter_add_fd() argument
329 ticket = waiter_add_null(w); in waiter_add_fd()
338 struct waiter_ticket *waiter_add_timeout(struct waiter *w, unsigned int ms) in waiter_add_timeout() argument
342 ticket = waiter_add_null(w); in waiter_add_timeout()
353 struct waiter *w = ticket->waiter; in waiter_ticket_delete() local
354 list_remove(&w->tickets, &ticket->list_item); in waiter_ticket_delete()
355 w->count--; in waiter_ticket_delete()