* Returns the lowest incomplete taskqid_t. The taskqid_t may * be queued on the pending list, on the priority list, on the * delay list, or on the work list currently being handled, but * it is not 100% complete yet. */
| 268 | * it is not 100% complete yet. |
| 269 | */ |
| 270 | static taskqid_t |
| 271 | taskq_lowest_id(taskq_t *tq) |
| 272 | { |
| 273 | taskqid_t lowest_id = tq->tq_next_id; |
| 274 | taskq_ent_t *t; |
| 275 | taskq_thread_t *tqt; |
| 276 | |
| 277 | ASSERT(tq); |
| 278 | |
| 279 | if (!list_empty(&tq->tq_pend_list)) { |
| 280 | t = list_entry(tq->tq_pend_list.next, taskq_ent_t, tqent_list); |
| 281 | lowest_id = MIN(lowest_id, t->tqent_id); |
| 282 | } |
| 283 | |
| 284 | if (!list_empty(&tq->tq_prio_list)) { |
| 285 | t = list_entry(tq->tq_prio_list.next, taskq_ent_t, tqent_list); |
| 286 | lowest_id = MIN(lowest_id, t->tqent_id); |
| 287 | } |
| 288 | |
| 289 | if (!list_empty(&tq->tq_delay_list)) { |
| 290 | t = list_entry(tq->tq_delay_list.next, taskq_ent_t, tqent_list); |
| 291 | lowest_id = MIN(lowest_id, t->tqent_id); |
| 292 | } |
| 293 | |
| 294 | if (!list_empty(&tq->tq_active_list)) { |
| 295 | tqt = list_entry(tq->tq_active_list.next, taskq_thread_t, |
| 296 | tqt_active_list); |
| 297 | ASSERT(tqt->tqt_id != TASKQID_INVALID); |
| 298 | lowest_id = MIN(lowest_id, tqt->tqt_id); |
| 299 | } |
| 300 | |
| 301 | return (lowest_id); |
| 302 | } |
| 303 | |
| 304 | /* |
| 305 | * Insert a task into a list keeping the list sorted by increasing taskqid. |
no test coverage detected