|
PatchworkOS
|
#include <kernel/sched/wait.h>#include <kernel/cpu/cpu.h>#include <kernel/cpu/smp.h>#include <kernel/log/panic.h>#include <kernel/sched/sched.h>#include <kernel/sched/thread.h>#include <kernel/sched/timer.h>#include <kernel/sync/lock.h>#include <assert.h>#include <errno.h>#include <stdatomic.h>#include <stdlib.h>#include <sys/list.h>Go to the source code of this file.
Functions | |
| static void | wait_remove_wait_entries (thread_t *thread, errno_t err) |
| static void | wait_timer_handler (interrupt_frame_t *frame, cpu_t *self) |
| 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. | |
Definition at line 17 of file wait.c.
References assert, atomic_load, wait_queue_t::entries, wait_thread_ctx_t::entries, wait_thread_ctx_t::err, free(), LIST_FOR_EACH_SAFE, list_remove(), wait_queue_t::lock, lock_acquire(), lock_release(), wait_entry_t::queueEntry, wait_entry_t::thread, THREAD_UNBLOCKING, wait_entry_t::threadEntry, thread_t::wait, and wait_entry_t::waitQueue.
Referenced by wait_block_cancel(), wait_block_commit(), wait_block_finalize(), wait_timer_handler(), wait_unblock(), and wait_unblock_thread().
|
static |
Definition at line 36 of file wait.c.
References atomic_compare_exchange_strong, wait_cpu_ctx_t::blockedThreads, CONTAINER_OF_SAFE, wait_cpu_ctx_t::cpu, wait_thread_ctx_t::cpu, wait_thread_ctx_t::deadline, thread_t::entry, ETIMEDOUT, list_first(), list_remove(), wait_cpu_ctx_t::lock, LOCK_SCOPE, NULL, sched_push(), THREAD_BLOCKED, THREAD_UNBLOCKING, timer_one_shot(), timer_uptime(), uptime(), cpu_t::wait, thread_t::wait, and wait_remove_wait_entries().
Referenced by wait_cpu_ctx_init().