* Block until all currently executing tasks for this taskqueue * complete. Tasks that begin execution during the execution * of this function are ignored. */
| 292 | * of this function are ignored. |
| 293 | */ |
| 294 | static void |
| 295 | gtaskqueue_drain_tq_active(struct gtaskqueue *queue) |
| 296 | { |
| 297 | struct gtaskqueue_busy *tb; |
| 298 | u_int seq; |
| 299 | |
| 300 | if (LIST_EMPTY(&queue->tq_active)) |
| 301 | return; |
| 302 | |
| 303 | /* Block taskq_terminate().*/ |
| 304 | queue->tq_callouts++; |
| 305 | |
| 306 | /* Wait for any active task with sequence from the past. */ |
| 307 | seq = queue->tq_seq; |
| 308 | restart: |
| 309 | LIST_FOREACH(tb, &queue->tq_active, tb_link) { |
| 310 | if ((int)(tb->tb_seq - seq) <= 0) { |
| 311 | TQ_SLEEP(queue, tb->tb_running, "gtq_adrain"); |
| 312 | goto restart; |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | /* Release taskqueue_terminate(). */ |
| 317 | queue->tq_callouts--; |
| 318 | if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0) |
| 319 | wakeup_one(queue->tq_threads); |
| 320 | } |
| 321 | |
| 322 | void |
| 323 | gtaskqueue_block(struct gtaskqueue *queue) |
no test coverage detected