MOS Source Code
Loading...
Searching...
No Matches
thread.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
5#include <mos/hashmap.hpp>
7#include <mos/types.h>
8
9typedef struct _hashmap hashmap_t;
10
12
14{
15 if (auto ptr = thread)
16 return ptr->magic == THREAD_MAGIC_THRD;
17 else
18 return false;
19}
20
22void thread_destroy(Thread *thread);
23
24PtrResult<Thread> thread_new(Process *owner, thread_mode mode, mos::string_view name, size_t stack_size, void *stack);
28
29[[noreturn]] void thread_exit(Thread *&&t);
30[[noreturn]] void thread_exit_locked(Thread *&&t);
#define THREAD_MAGIC_THRD
thread_mode
void define_syscall thread_exit(void)
Definition ksyscall.cpp:175
#define should_inline
Definition mos_global.h:37
basic_string_view< char > string_view
mos::shared_ptr< T > ptr
const char * name
Definition slab.cpp:35
should_inline bool thread_is_valid(const Thread *thread)
Definition thread.hpp:13
void thread_destroy(Thread *thread)
Definition thread.cpp:52
Thread * thread_get(tid_t id)
Definition thread.cpp:174
mos::HashMap< tid_t, Thread * > thread_table
Definition thread.cpp:24
Thread * thread_allocate(Process *owner, thread_mode tflags)
Definition thread.cpp:37
bool thread_wait_for_tid(tid_t tid)
Definition thread.cpp:189
PtrResult< Thread > thread_new(Process *owner, thread_mode mode, mos::string_view name, size_t stack_size, void *stack)
Definition thread.cpp:77
void thread_exit_locked(Thread *&&t)
Definition thread.cpp:217
Thread * thread_complete_init(Thread *thread)
Definition thread.cpp:165
s32 tid_t
Definition types.h:75