cosmopolitan/third_party/nsync/wait_s.internal.h
Justine Tunney f24c854b28
Write more runtime tests and fix bugs
This change adds tests for the new memory manager code particularly with
its windows support. Function call tracing now works reliably on Silicon
since our function hooker was missing new Apple self-modifying code APIs

Many tests that were disabled a long time ago on aarch64 are reactivated
by this change, now that arm support is on equal terms with x86. There's
been a lot of places where ftrace could cause deadlocks, which have been
hunted down across all platforms thanks to new tests. A bug in Windows's
kill() function has been identified.
2025-01-01 22:25:22 -08:00

29 lines
1.1 KiB
C

#ifndef COSMOPOLITAN_LIBC_THREAD_WAIT_INTERNAL_H_
#define COSMOPOLITAN_LIBC_THREAD_WAIT_INTERNAL_H_
#include "libc/intrin/dll.h"
#include "third_party/nsync/defs.h"
#include "third_party/nsync/atomic.h"
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 {
#if NSYNC_DEBUG
uint32_t tag; /* used for debugging */
#endif
uint32_t flags; /* see below */
nsync_atomic_uint32_ waiting; /* non-zero <=> the waiter is waiting */
struct Dll q; /* used to link children of parent */
struct nsync_semaphore_s_ *sem; /* *sem will be Ved when waiter is woken */
};
/* set if waiter is embedded in Mu/CV's internal structures */
#define NSYNC_WAITER_FLAG_MUCV 0x1
void nsync_waiter_destroy_(void *);
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_THREAD_WAIT_INTERNAL_H_ */