PatchworkOS
Loading...
Searching...
No Matches
wait.h File Reference
#include <kernel/cpu/regs.h>
#include <kernel/sync/lock.h>
#include <errno.h>
#include <sys/list.h>
#include <sys/proc.h>

Go to the source code of this file.

Data Structures

struct  wait_queue_t
 Wait queue structure. More...
 
struct  wait_entry_t
 Per-thread wait entry. More...
 
struct  wait_cpu_ctx_t
 Per-CPU wait context. More...
 
struct  wait_thread_ctx_t
 Per-thread wait context. More...
 

Macros

#define WAIT_ALL   UINT64_MAX
 Wait for all.
 
#define WAIT_BLOCK(waitQueue, condition)
 Basic block.
 
#define WAIT_BLOCK_TIMEOUT(waitQueue, condition, timeout)
 Block with timeout.
 
#define WAIT_BLOCK_LOCK(waitQueue, lock, condition)
 Block with a spinlock.
 
#define WAIT_BLOCK_LOCK_TIMEOUT(waitQueue, lock, condition, timeout)
 Block with a spinlock and timeout.
 
#define WAIT_QUEUE_CREATE(name)   {.lock = LOCK_CREATE, .entries = LIST_CREATE(name.entries)}
 Create a wait queue initializer.
 

Typedefs

typedef struct thread thread_t
 
typedef struct cpu cpu_t
 

Functions

void wait_queue_init (wait_queue_t *waitQueue)
 Initialize wait queue.
 
void wait_queue_deinit (wait_queue_t *waitQueue)
 Deinitialize wait queue.
 
void wait_thread_ctx_init (wait_thread_ctx_t *wait)
 Initialize per-thread wait context.
 
void wait_cpu_ctx_init (wait_cpu_ctx_t *wait, cpu_t *self)
 Initialize per-CPU wait context.
 
bool wait_block_finalize (interrupt_frame_t *frame, cpu_t *self, thread_t *thread, clock_t uptime)
 Finalize blocking of a thread.
 
void wait_unblock_thread (thread_t *thread, errno_t err)
 Unblock a specific thread.
 
uint64_t wait_unblock (wait_queue_t *waitQueue, uint64_t amount, errno_t err)
 Unblock threads waiting on a wait queue.
 
uint64_t wait_block_setup (wait_queue_t **waitQueues, uint64_t amount, clock_t timeout)
 Setup blocking but dont block yet.
 
void wait_block_cancel (void)
 Cancel blocking.
 
uint64_t wait_block_commit (void)
 Block the currently running thread.
 

Typedef Documentation

◆ cpu_t

typedef struct cpu cpu_t

Definition at line 11 of file wait.h.

◆ thread_t

typedef struct thread thread_t

Definition at line 10 of file wait.h.