mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08:31 +00:00
[WIP] Threading phase 2 (#301)
* Exponential back-off * Removed "native" specifier * Abstract away Futex for cthread * Complete setup for TLS (including main thread)
This commit is contained in:
parent
660ff56d40
commit
45a7435788
11 changed files with 249 additions and 78 deletions
28
libc/thread/sem.h
Normal file
28
libc/thread/sem.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#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_sem_t {
|
||||
struct {
|
||||
uint64_t count;
|
||||
} linux;
|
||||
} cthread_sem_t;
|
||||
|
||||
struct timespec;
|
||||
|
||||
int cthread_sem_init(cthread_sem_t*, int);
|
||||
int cthread_sem_destroy(cthread_sem_t*);
|
||||
|
||||
int cthread_sem_wait(cthread_sem_t*, int, const struct timespec*);
|
||||
int cthread_sem_signal(cthread_sem_t*);
|
||||
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_THREAD_SELF_H_ */
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue