|
P99
|
Collaboration diagram for C11 thread emulation on top of POSIX threads:Data Structures | |
| struct | p99_tss |
| A stub structure to hold a thread local variable if thread_local is not available. More... | |
Modules | |
| Thread_macros | |
| Thread_types | |
| Thread_enum | |
Defines | |
| #define | P99_DECLARE_ONCE_CHAIN(T) extern p99_once_flag P99_PASTE3(p99_, T, _once) |
| Declare the symbols that are needed for the macro P99_INIT_CHAIN(). | |
| #define | P99_DECLARE_THREAD_LOCAL(T, NAME) |
| declare a thread local variable NAME of type T | |
| #define | P99_DEFINE_ONCE_CHAIN(T,...) |
Define the function that will be exactly called once by P99_INIT_CHAIN(T). | |
| #define | P99_INIT_CHAIN(T) p99_call_once(&P99_PASTE3(p99_, T, _once), P99_PASTE3(p99_, T, _once).p00_init) |
| Ensure that the function that was defined with P99_DEFINE_ONCE_CHAIN has been called exactly once before further proceeding. | |
| #define | P99_MUTUAL_EXCLUDE(MUT) |
Protect the following block or statement with mtx_t MUT. | |
| #define | P99_THREAD_LOCAL(NAME) (*(P99_PASTE3(p00_, NAME, _type)*)p00_thread_local_get(&(NAME), sizeof(P99_PASTE3(p00_, NAME, _type)))) |
| an lvalue expression that returns the thread local instance of variable NAME | |
Typedefs | |
| typedef struct p99_tss | p99_tss |
Functions | |
| int | cnd_t::cnd_broadcast (cnd_t *p00_cond) |
| void | cnd_t::cnd_destroy (cnd_t *p00_cond) |
| int | cnd_t::cnd_init (cnd_t *p00_cond) |
| int | cnd_t::cnd_signal (cnd_t *p00_cond) |
| int | cnd_t::cnd_timedwait (cnd_t *restrict p00_cond, mtx_t *restrict p00_mtx, const struct timespec *restrict p00_ts) |
| int | cnd_t::cnd_wait (cnd_t *p00_cond, mtx_t *p00_mtx) |
| void | mtx_t::mtx_destroy (mtx_t *p00_mtx) |
| int | mtx_t::mtx_init (mtx_t *p00_mtx, int p00_type) |
| int | mtx_t::mtx_lock (mtx_t *p00_mtx) |
| int | mtx_t::mtx_timedlock (mtx_t *restrict p00_mtx, const struct timespec *restrict p00_ts) |
| int | mtx_t::mtx_trylock (mtx_t *p00_mtx) |
| int | mtx_t::mtx_unlock (mtx_t *p00_mtx) |
| int | thrd_t::thrd_create (thrd_t *p00_thr, thrd_start_t p00_func, void *p00_arg) |
| thrd_t | thrd_t::thrd_current (void) |
| int | thrd_t::thrd_detach (thrd_t p00_thr) |
| int | thrd_t::thrd_equal (thrd_t p00_thr0, thrd_t p00_thr1) |
| void | thrd_t::thrd_exit (int p00_res) |
| int | thrd_t::thrd_join (thrd_t p00_thr, int *p00_res) |
| int | thrd_t::thrd_sleep (const struct timespec *p00_duration, struct timespec *p00_remaining) |
| void | thrd_t::thrd_yield (void) |
| int | tss_t::tss_create (tss_t *p00_key, tss_dtor_t dtor) |
| void | tss_t::tss_delete (tss_t p00_key) |
| void * | tss_t::tss_get (tss_t p00_key) |
| int | tss_t::tss_set (tss_t p00_key, void *p00_val) |
This is a relatively straight forward implementation of the C11 thread model on top of POSIX threads. The main difficulty in that is that the thread entry function signature differs between the two. C11 thread returns an int whereas POSIX returns a void*.
You find the thread management interfaces through the documentation of the type thrd_t.
1.7.6.1