mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 11:18:30 +00:00
Use *NSYNC for POSIX threads locking APIs
Condition variables, barriers, and r/w locks now work very well.
This commit is contained in:
parent
3de35e196c
commit
b5cb71ab84
197 changed files with 3734 additions and 3817 deletions
26
third_party/nsync/wait_s.internal.h
vendored
Normal file
26
third_party/nsync/wait_s.internal.h
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_THREAD_WAIT_INTERNAL_H_
|
||||
#define COSMOPOLITAN_LIBC_THREAD_WAIT_INTERNAL_H_
|
||||
#include "third_party/nsync/atomic.h"
|
||||
#include "third_party/nsync/dll.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* Implementations of "struct nsync_waitable_s" must provide functions
|
||||
in struct nsync_waitable_funcs_s (see public/nsync_wait.h). When
|
||||
nsync_wait_n() waits on a client's object, those functions are called
|
||||
with v pointing to the client's object and nw pointing to a struct
|
||||
nsync_waiter_s. */
|
||||
struct nsync_waiter_s {
|
||||
uint32_t tag; /* used for debugging */
|
||||
nsync_dll_element_ q; /* used to link children of parent */
|
||||
nsync_atomic_uint32_ waiting; /* non-zero <=> the waiter is waiting */
|
||||
struct nsync_semaphore_s_ *sem; /* *sem will be Ved when waiter is woken */
|
||||
uint32_t flags; /* see below */
|
||||
};
|
||||
|
||||
/* set if waiter is embedded in Mu/CV's internal structures */
|
||||
#define NSYNC_WAITER_FLAG_MUCV 0x1
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_THREAD_WAIT_INTERNAL_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue