|
PatchworkOS
|
#include <errno.h>#include <stdatomic.h>#include <stdbool.h>#include <sys/list.h>#include <sys/proc.h>#include <threads.h>Go to the source code of this file.
Data Structures | |
| struct | _thread_t |
Macros | |
| #define | _MTX_SPIN_COUNT 100 |
| #define | _THREAD_ENTRY_ATTRIBUTES __attribute__((noreturn)) __attribute__((force_align_arg_pointer)) |
| #define | _THREAD_ATTACHED 1 |
| #define | _THREAD_DETACHED 2 |
| #define | _THREAD_JOINING 3 |
| #define | _THREAD_EXITED 4 |
Typedefs | |
| typedef struct _thread | _thread_t |
| typedef void(* | _thread_entry_t) (_thread_t *) |
Functions | |
| void | _threading_init (void) |
| _thread_t * | _thread_new (_thread_entry_t entry, void *private) |
| void | _thread_free (_thread_t *thread) |
| _thread_t * | _thread_get (tid_t id) |
| #define _THREAD_ENTRY_ATTRIBUTES __attribute__((noreturn)) __attribute__((force_align_arg_pointer)) |
| void _thread_free | ( | _thread_t * | thread | ) |
Definition at line 61 of file thread.c.
References _thread_t::entry, free(), list_remove(), mtx_lock(), mtx_unlock(), mutex, thread0, and threads.
Referenced by thrd_exit(), and thrd_join().
Definition at line 72 of file thread.c.
References _thread_t::id, LIST_FOR_EACH, mtx_lock(), mtx_unlock(), mutex, NULL, and threads.
Referenced by _errno_get(), thrd_detach(), thrd_exit(), and thrd_join().
| _thread_t * _thread_new | ( | _thread_entry_t | entry, |
| void * | private | ||
| ) |
Definition at line 33 of file thread.c.
References _syscall_errno(), _syscall_thread_create(), _thread_init(), _thread_t::entry, ERR, errno, free(), _thread_t::id, list_push(), malloc(), mtx_lock(), mtx_unlock(), mutex, NULL, _thread_t::private, and threads.
Referenced by thrd_create().
| void _threading_init | ( | void | ) |
Definition at line 21 of file thread.c.
References _syscall_gettid(), _thread_init(), _thread_t::entry, _thread_t::id, list_init(), list_push(), mtx_init(), mtx_recursive, mutex, thread0, and threads.
Referenced by _user_init().