mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 00:08:30 +00:00
Add much of C11 threads.h API
This commit is contained in:
parent
2bfd6b37c1
commit
0eef971494
12 changed files with 141 additions and 0 deletions
36
libc/thread/threads.h
Normal file
36
libc/thread/threads.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_THREAD_THREADS_H_
|
||||
#define COSMOPOLITAN_LIBC_THREAD_THREADS_H_
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define TSS_DTOR_ITERATIONS 4
|
||||
|
||||
enum {
|
||||
thrd_success = 0,
|
||||
thrd_busy = 1,
|
||||
thrd_error = 2,
|
||||
thrd_nomem = 3,
|
||||
thrd_timedout = 4,
|
||||
};
|
||||
|
||||
enum {
|
||||
mtx_plain = 0,
|
||||
mtx_recursive = 1,
|
||||
mtx_timed = 2,
|
||||
};
|
||||
|
||||
typedef uintptr_t thrd_t;
|
||||
typedef void (*tss_dtor_t)(void *);
|
||||
typedef int (*thrd_start_t)(void *);
|
||||
typedef _Atomic(uint32_t) once_flag;
|
||||
|
||||
void call_once(once_flag *, void (*)(void));
|
||||
int thrd_create(thrd_t *, thrd_start_t, void *);
|
||||
void thrd_exit(int) wontreturn;
|
||||
int thrd_join(thrd_t, int *);
|
||||
int thrd_detach(thrd_t);
|
||||
int thrd_equal(thrd_t, thrd_t);
|
||||
thrd_t thrd_current(void);
|
||||
void thrd_yield(void);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_THREAD_THREADS_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue