cosmopolitan/libc/thread/nativesem.h
Florian Lemaitre a0b39f886c
[WIP] Threading (#282)
* Thread creation
* Proper thread creation and exit
* Join/Detach protocol
* Added semaphore with futex (hopefully fast)
2021-10-13 11:26:05 -07:00

28 lines
716 B
C

#ifndef COSMOPOLITAN_LIBC_THREAD_NATIVESEM_H_
#define COSMOPOLITAN_LIBC_THREAD_NATIVESEM_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/**
* @fileoverview native semaphore for implementation details
*/
typedef union cthread_native_sem_t {
struct {
uint64_t count;
} linux;
} cthread_native_sem_t;
struct timespec;
int cthread_native_sem_init(cthread_native_sem_t*, int);
int cthread_native_sem_destroy(cthread_native_sem_t*);
int cthread_native_sem_wait(cthread_native_sem_t*, int, int, const struct timespec*);
int cthread_native_sem_signal(cthread_native_sem_t*);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_THREAD_SELF_H_ */