| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
|---|---|
| 2 | |
| 3 | #pragma once |
| 4 | |
| 5 | #include <mos/hashmap.hpp> |
| 6 | #include <mos/tasks/task_types.hpp> |
| 7 | #include <mos/types.h> |
| 8 | |
| 9 | typedef struct _hashmap hashmap_t; |
| 10 | |
| 11 | extern mos::HashMap<tid_t, Thread *> thread_table; |
| 12 | |
| 13 | Thread *thread_allocate(Process *owner, thread_mode tflags); |
| 14 | void thread_destroy(Thread *thread); |
| 15 | |
| 16 | PtrResult<Thread> thread_new(Process *owner, thread_mode mode, mos::string_view name, size_t stack_size, void *stack); |
| 17 | Thread *thread_complete_init(Thread *thread); |
| 18 | Thread *thread_get(tid_t id); |
| 19 | bool thread_wait_for_tid(tid_t tid); |
| 20 | |
| 21 | [[noreturn]] void thread_exit(Thread *&&t); |
| 22 | [[noreturn]] void thread_exit_locked(Thread *&&t); |
| 23 |