| 223 | } |
| 224 | |
| 225 | int |
| 226 | grouptaskqueue_enqueue(struct gtaskqueue *queue, struct gtask *gtask) |
| 227 | { |
| 228 | #ifdef INVARIANTS |
| 229 | if (queue == NULL) { |
| 230 | gtask_dump(gtask); |
| 231 | panic("queue == NULL"); |
| 232 | } |
| 233 | #endif |
| 234 | TQ_LOCK(queue); |
| 235 | if (gtask->ta_flags & TASK_ENQUEUED) { |
| 236 | TQ_UNLOCK(queue); |
| 237 | return (0); |
| 238 | } |
| 239 | if (gtask->ta_flags & TASK_NOENQUEUE) { |
| 240 | TQ_UNLOCK(queue); |
| 241 | return (EAGAIN); |
| 242 | } |
| 243 | STAILQ_INSERT_TAIL(&queue->tq_queue, gtask, ta_link); |
| 244 | gtask->ta_flags |= TASK_ENQUEUED; |
| 245 | TQ_UNLOCK(queue); |
| 246 | if ((queue->tq_flags & TQ_FLAGS_BLOCKED) == 0) |
| 247 | queue->tq_enqueue(queue->tq_context); |
| 248 | return (0); |
| 249 | } |
| 250 | |
| 251 | static void |
| 252 | gtaskqueue_task_nop_fn(void *context) |
no test coverage detected