Lines Matching refs:node

65 	iu_timer_node_t *node, *next_node;
67 for (node = tq->iutq_head; node != NULL; node = next_node) {
68 next_node = node->iutn_next;
69 destroy_timer(tq, node);
76 * insert_timer(): inserts a timer node into a tq's timer list
79 * iu_timer_node_t *: the timer node to insert into the list
85 insert_timer(iu_tq_t *tq, iu_timer_node_t *node, uint64_t msec)
90 * find the node to insert this new node "after". we do this
92 * the insert before approach, a null `before' node pointer
98 node->iutn_abs_timeout = gethrtime() + MSEC2NSEC(msec);
101 tq->iutq_head->iutn_abs_timeout < node->iutn_abs_timeout)
105 node->iutn_abs_timeout)
108 node->iutn_next = after ? after->iutn_next : tq->iutq_head;
109 node->iutn_prev = after;
111 tq->iutq_head = node;
113 after->iutn_next = node;
115 if (node->iutn_next != NULL)
116 node->iutn_next->iutn_prev = node;
120 * remove_timer(): removes a timer node from the tq's timer list
123 * iu_timer_node_t *: the timer node to remove from the list
128 remove_timer(iu_tq_t *tq, iu_timer_node_t *node)
130 if (node->iutn_next != NULL)
131 node->iutn_next->iutn_prev = node->iutn_prev;
132 if (node->iutn_prev != NULL)
133 node->iutn_prev->iutn_next = node->iutn_next;
135 tq->iutq_head = node->iutn_next;
139 * destroy_timer(): destroy a timer node
141 * input: iu_tq_t *: the timer queue the timer node is associated with
142 * iu_timer_node_t *: the node to free
147 destroy_timer(iu_tq_t *tq, iu_timer_node_t *node)
149 release_timer_id(tq, node->iutn_timer_id);
152 * if we're in expire, don't delete the node yet, since it may
157 node->iutn_pending_delete++;
158 node->iutn_next = pending_delete_chain;
159 pending_delete_chain = node;
161 free(node);
196 iu_timer_node_t *node = calloc(1, sizeof (iu_timer_node_t));
198 if (node == NULL)
201 node->iutn_callback = callback;
202 node->iutn_arg = arg;
203 node->iutn_timer_id = get_timer_id(tq);
204 if (node->iutn_timer_id == -1) {
205 free(node);
209 insert_timer(tq, node, ms);
211 return (node->iutn_timer_id);
227 iu_timer_node_t *node;
232 for (node = tq->iutq_head; node != NULL; node = node->iutn_next) {
233 if (node->iutn_timer_id == timer_id) {
235 *arg = node->iutn_arg;
236 remove_timer(tq, node);
237 destroy_timer(tq, node);
256 iu_timer_node_t *node;
261 for (node = tq->iutq_head; node != NULL; node = node->iutn_next) {
262 if (node->iutn_timer_id == timer_id) {
263 remove_timer(tq, node);
264 insert_timer(tq, node, sec * MILLISEC);
317 iu_timer_node_t *node, *next_node;
336 for (node = tq->iutq_head; node != NULL; node = node->iutn_next)
337 node->iutn_expire_next = node->iutn_next;
339 for (node = tq->iutq_head; node != NULL;
340 node = node->iutn_expire_next) {
349 if (node->iutn_abs_timeout - current_time > 1000000)
360 if (node->iutn_pending_delete)
370 remove_timer(tq, node);
371 destroy_timer(tq, node);
372 node->iutn_callback(tq, node->iutn_arg);
383 for (node = pending_delete_chain; node != NULL; node = next_node) {
384 next_node = node->iutn_next;
385 free(node);