Workqueues
| Member Type | Member Name |
|---|---|
void | *arg1 |
void | *arg2 |
| Member Type | Member Name |
|---|---|
size_t | timer |
uint64_t | timestamp_ms |
work_function | callback |
struct work_args | args |
struct deferred_event | *next |
| Member Type | Member Name |
|---|---|
work_function | func |
struct work_args | args |
struct list_head | list_node |
atomic_bool | enqueued |
atomic_bool | active |
uint64_t | seq |
| Member Type | Member Name |
|---|---|
enum worklist_state | state |
struct list_head | list |
time_t | creation_time |
struct spinlock | lock |
enum worklist_flags | flags |
refcount_t | refcount |
| Member Type | Member Name |
|---|---|
uint64_t | total_tasks_added |
uint64_t | total_tasks_executed |
uint64_t | total_workers_spawned |
uint64_t | total_worker_exits |
uint64_t | max_queue_length |
uint64_t | current_queue_length |
uint64_t | total_spawn_attempts |
uint64_t | total_spawn_failures |
uint64_t | num_idle_workers |
uint64_t | num_active_workers |
| Member Type | Member Name |
|---|---|
size_t | min_workers |
size_t | max_workers |
size_t | capacity |
time_t | spawn_delay |
nice_t | worker_niceness |
struct { uint64_t min; uint64_t max; } | idle_check |
enum workqueue_flags | flags |
struct cpu_mask | worker_cpu_mask |
| Name | Value |
|---|---|
WORKER_NEXT_ACTION_RUN | None |
WORKER_NEXT_ACTION_EXIT | None |
| Name | Value |
|---|---|
WORKLIST_STATE_EMPTY | 0 |
WORKLIST_STATE_READY | 1 |
WORKLIST_STATE_RUNNING | 2 |
WORKLIST_STATE_DESTROYING | 3 |
WORKLIST_STATE_DEAD | 4 |
| Name | Value |
|---|---|
WORKLIST_FLAG_UNBOUND | 1 |
| Name | Value |
|---|---|
WORKQUEUE_STATE_DEAD | None |
WORKQUEUE_STATE_DESTROYING | None |
WORKQUEUE_STATE_ACTIVE | None |
type alias
Section titled “type alias”(*work_function) : void (void *arg, void *arg2)
voiddefer_init(void)booldefer_enqueue(work_function func,struct work_argsargs,uint64_t delay_ms)voidworkqueues_permanent_init(void)struct workqueue *workqueue_create(struct workqueue_attributes*attrs,char *fmt)struct work *work_create(work_function func,struct work_argsargs)struct work *work_init(struct work*work,work_function fn,struct work_argsargs)voidworkqueue_free(struct workqueue*queue)enum workqueue_errorworkqueue_enqueue_oneshot(struct workqueue*queue,work_function func,struct work_argsargs)enum workqueue_errorworkqueue_enqueue(struct workqueue*queue,struct work*work)enum workqueue_errorworkqueue_add_oneshot(work_function func,struct work_argsargs)enum workqueue_errorworkqueue_add_remote_oneshot(work_function func,struct work_argsargs)enum workqueue_errorworkqueue_add_local_oneshot(work_function func,struct work_argsargs)enum workqueue_errorworkqueue_add_fast_oneshot(work_function func,struct work_argsargs)enum workqueue_errorworkqueue_add(struct work*work)enum workqueue_errorworkqueue_add_remote(struct work*work)enum workqueue_errorworkqueue_add_local(struct work*work)enum workqueue_errorworkqueue_add_fast(struct work*work)voidwork_execute(struct work*task)boolworkqueue_should_spawn_worker(struct workqueue*queue)struct worklist *worklist_create(enum worklist_flags)voidworklist_free(struct worklist*wlist)voidworkqueue_kick(struct workqueue*queue)voidworkqueue_destroy(struct workqueue*queue)voidworker_main(void *)static inline boolwork_active(struct work*work)
Defines
Section titled “Defines”WORKQUEUE_DEFAULT_CAPACITY:512WORKQUEUE_DEFAULT_MAX_WORKERS:16WORKQUEUE_DEFAULT_SPAWN_DELAY:150WORKQUEUE_DEFAULT_MIN_IDLE_CHECK:SECONDS_TO_MS(2)WORKQUEUE_DEFAULT_MAX_IDLE_CHECK:SECONDS_TO_MS(40)