| 1 | /* @title: Thread queue */ |
|---|---|
| 2 | #pragma once |
| 3 | #include <structures/list.h> |
| 4 | #include <sync/spinlock.h> |
| 5 | |
| 6 | struct thread_queue { |
| 7 | struct list_head list; |
| 8 | struct spinlock lock; |
| 9 | }; |
| 10 | |
| 11 | void thread_queue_init(struct thread_queue *q); |
| 12 | void thread_queue_push_back(struct thread_queue *q, struct thread *t); |
| 13 | struct thread *thread_queue_pop_front(struct thread_queue *q); |
| 14 | void thread_queue_clear(struct thread_queue *q); |
| 15 | bool thread_queue_remove(struct thread_queue *q, struct thread *t); |
| 16 |