46#ifndef KERNEL_WORKER_H
47#define KERNEL_WORKER_H
50#include <kernel/waitqueue.h>
62#define INIT_WORKER(_worker) \
63 _worker = ((struct worker){ \
64 .queue = __WAITQUEUE_INIT((_worker).queue), \
70#define DECLARE_WORKER(_worker) struct worker INIT_WORKER(_worker)
73error_t worker_init(
struct worker *);
79void worker_wait(
struct worker *);
82void worker_release(
struct worker *);
85static inline bool worker_running(
const struct worker *
worker)
void(* thread_entry_t)(void *data)
A function used as an entry point when creating a new thread.
Definition: process.h:64
A single thread.
Definition: process.h:121
Waiting Queue.
Definition: waitqueue.h:39
Worker thread.
Definition: worker.h:53
void * data
Worker thread's entrypoint.
Definition: worker.h:58
thread_entry_t function
Whether the thread has finished.
Definition: worker.h:57
struct waitqueue queue
Worker thread.
Definition: worker.h:55
bool done
The processes waiting for this thread to finish.
Definition: worker.h:56