Lines Matching defs:tmq

48 fmd_timerq_install(fmd_timerq_t *tmq, fmd_idspace_t *ids,
58 (void) pthread_mutex_lock(&tmq->tmq_lock);
60 if ((tp = fmd_list_next(&tmq->tmq_free)) == NULL) {
64 fmd_list_delete(&tmq->tmq_free, tp);
67 fmd_list_prepend(&tmq->tmq_free, tp);
68 (void) pthread_mutex_unlock(&tmq->tmq_lock);
91 for (up = fmd_list_next(&tmq->tmq_list); up; up = fmd_list_next(up)) {
97 fmd_list_insert_before(&tmq->tmq_list, up, tp);
99 fmd_list_insert_after(&tmq->tmq_list, up, tp);
101 if (up != NULL && fmd_list_next(&tmq->tmq_list) == tp)
102 fmd_time_waitcancel(tmq->tmq_thread->thr_tid);
103 else if (up == NULL && fmd_list_next(&tmq->tmq_list) == tp)
104 (void) pthread_cond_signal(&tmq->tmq_cv);
106 (void) pthread_mutex_unlock(&tmq->tmq_lock);
122 fmd_timerq_remove(fmd_timerq_t *tmq, fmd_idspace_t *ids, id_t id)
128 (void) pthread_mutex_lock(&tmq->tmq_lock);
133 (void) pthread_mutex_unlock(&tmq->tmq_lock);
138 fmd_list_delete(&tmq->tmq_list, tp);
142 fmd_list_append(&tmq->tmq_free, tp);
150 if (fmd_list_next(&tmq->tmq_list) == NULL)
151 fmd_time_waitcancel(tmq->tmq_thread->thr_tid);
159 (void) pthread_cond_wait(&tp->tmr_cv, &tmq->tmq_lock);
162 (void) pthread_mutex_unlock(&tmq->tmq_lock);
179 fmd_timerq_exec(fmd_timerq_t *tmq)
195 (void) pthread_mutex_lock(&tmq->tmq_lock);
198 while (!tmq->tmq_abort && fmd_list_next(&tmq->tmq_list) == NULL)
199 (void) pthread_cond_wait(&tmq->tmq_cv, &tmq->tmq_lock);
201 if (tmq->tmq_abort) {
202 (void) pthread_mutex_unlock(&tmq->tmq_lock);
207 &tmq->tmq_list)) != NULL; now = fmd_time_gethrtime()) {
213 fmd_list_delete(&tmq->tmq_list, tp);
214 (void) pthread_mutex_unlock(&tmq->tmq_lock);
224 (void) pthread_mutex_lock(&tmq->tmq_lock);
226 fmd_list_append(&tmq->tmq_free, tp);
233 (void) pthread_mutex_unlock(&tmq->tmq_lock);
235 (void) pthread_mutex_lock(&tmq->tmq_lock);
249 fmd_timerq_t *tmq = fmd_zalloc(sizeof (fmd_timerq_t), FMD_SLEEP);
252 (void) pthread_mutex_init(&tmq->tmq_lock, NULL);
253 (void) pthread_cond_init(&tmq->tmq_cv, NULL);
260 if ((tmq->tmq_thread = fmd_thread_create(fmd.d_rmod,
261 (fmd_thread_f *)fmd_timerq_exec, tmq)) == NULL)
264 return (tmq);
268 fmd_timerq_destroy(fmd_timerq_t *tmq)
273 (void) pthread_mutex_lock(&tmq->tmq_lock);
274 tmq->tmq_abort++;
276 if (fmd_list_next(&tmq->tmq_list) != NULL)
277 fmd_time_waitcancel(tmq->tmq_thread->thr_tid);
279 (void) pthread_cond_signal(&tmq->tmq_cv);
281 (void) pthread_mutex_unlock(&tmq->tmq_lock);
282 fmd_thread_destroy(tmq->tmq_thread, FMD_THREAD_JOIN);
283 (void) pthread_mutex_lock(&tmq->tmq_lock);
285 while ((tmr = fmd_list_next(&tmq->tmq_list)) != NULL) {
286 fmd_list_delete(&tmq->tmq_list, tmr);
291 while ((tmr = fmd_list_next(&tmq->tmq_free)) != NULL) {
292 fmd_list_delete(&tmq->tmq_free, tmr);
302 fmd_free(tmq, sizeof (fmd_timerq_t));