Lines Matching defs:q
79 struct queue *q;
99 if ((q = malloc(sizeof (*q))) == NULL) {
105 q->head = NULL;
106 q->lock = lock;
107 q->wait = wait;
108 q->count = 0;
110 return (q);
114 * Adds msg to the tail of queue q.
120 struct queue *q = qa;
127 (void) mutex_lock(q->lock);
130 if (q->head != NULL) { /* queue is not emptry */
131 q->tail->next = qe;
132 q->tail = qe;
134 q->head = q->tail = qe;
136 q->count++;
137 (void) mutex_unlock(q->lock);
138 (void) cond_signal(q->wait);
149 struct queue *q = qa;
156 (void) mutex_lock(q->lock);
158 qe->next = q->head;
159 q->head = qe;
161 q->count++;
162 (void) mutex_unlock(q->lock);
163 (void) cond_signal(q->wait);
171 static void *dequeue_nolock(struct queue *q) {
173 slp_queue_entry_t *qe = q->head;
179 q->head = q->tail = NULL;
181 q->head = qe->next;
183 q->count--;
196 struct queue *q = qa;
201 (void) mutex_lock(q->lock);
202 if (q->count > 0) {
203 /* something's in the q, so no need to wait */
208 while (q->count == 0) {
210 err = cond_timedwait(q->wait, q->lock, to);
212 err = cond_wait(q->wait, q->lock);
215 (void) mutex_unlock(q->lock);
222 ans = dequeue_nolock(q);
223 (void) mutex_unlock(q->lock);
241 struct queue *q = qa;
243 for (p = q->head; p; p = pn) {
255 struct queue *q = qa;
257 (void) mutex_destroy(q->lock);
258 (void) cond_destroy(q->wait);
259 free(q->lock);
260 free(q->wait);
261 free(q);