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
9typedef struct _hashmap hashmap_t;
10
11extern mos::HashMap<tid_t, Thread *> thread_table;
12
13Thread *thread_allocate(Process *owner, thread_mode tflags);
14void thread_destroy(Thread *thread);
15
16PtrResult<Thread> thread_new(Process *owner, thread_mode mode, mos::string_view name, size_t stack_size, void *stack);
17Thread *thread_complete_init(Thread *thread);
18Thread *thread_get(tid_t id);
19bool thread_wait_for_tid(tid_t tid);
20
21[[noreturn]] void thread_exit(Thread *&&t);
22[[noreturn]] void thread_exit_locked(Thread *&&t);
23