mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Reduce header complexity
- Remove most __ASSEMBLER__ __LINKER__ ifdefs - Rename libc/intrin/bits.h to libc/serialize.h - Block pthread cancelation in fchmodat() polyfill - Remove `clang-format off` statements in third_party
This commit is contained in:
parent
96f979dfc5
commit
fa20edc44d
3057 changed files with 410 additions and 4398 deletions
1
third_party/nsync/array.internal.h
vendored
1
third_party/nsync/array.internal.h
vendored
|
@ -1,6 +1,5 @@
|
|||
#ifndef NSYNC_ARRAY_H_
|
||||
#define NSYNC_ARRAY_H_
|
||||
/* clang-format off */
|
||||
|
||||
/* Return the number of elements in a C array a.
|
||||
A constant expression if a is a constant expression. */
|
||||
|
|
2
third_party/nsync/atomic.h
vendored
2
third_party/nsync/atomic.h
vendored
|
@ -1,7 +1,6 @@
|
|||
#ifndef NSYNC_ATOMIC_H_
|
||||
#define NSYNC_ATOMIC_H_
|
||||
#include "libc/atomic.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define nsync_atomic_uint32_ atomic_uint
|
||||
|
@ -12,5 +11,4 @@ COSMOPOLITAN_C_START_
|
|||
#define NSYNC_ATOMIC_UINT32_PTR_(p) (p)
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_ATOMIC_H_ */
|
||||
|
|
2
third_party/nsync/atomic.internal.h
vendored
2
third_party/nsync/atomic.internal.h
vendored
|
@ -3,7 +3,6 @@
|
|||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/intrin/cmpxchg.h"
|
||||
#include "third_party/nsync/atomic.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* Atomic operations on nsync_atomic_uint32_ quantities
|
||||
|
@ -118,5 +117,4 @@ static inline int atm_cas_seqcst_u32_(nsync_atomic_uint32_ *p, uint32_t o,
|
|||
memory_order_release))
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_ATOMIC_INTERNAL_H_ */
|
||||
|
|
1
third_party/nsync/common.c
vendored
1
third_party/nsync/common.c
vendored
|
@ -39,7 +39,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
/* This package provides a mutex nsync_mu and a Mesa-style condition
|
||||
* variable nsync_cv. */
|
||||
|
|
2
third_party/nsync/common.internal.h
vendored
2
third_party/nsync/common.internal.h
vendored
|
@ -10,7 +10,6 @@
|
|||
#include "third_party/nsync/note.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
#include "third_party/nsync/wait_s.internal.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#ifdef MODE_DBG
|
||||
|
@ -278,5 +277,4 @@ int nsync_sem_wait_with_cancel_(waiter *w, nsync_time abs_deadline,
|
|||
nsync_note cancel_note);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_COMMON_H_ */
|
||||
|
|
2
third_party/nsync/counter.h
vendored
2
third_party/nsync/counter.h
vendored
|
@ -2,7 +2,6 @@
|
|||
#define NSYNC_COUNTER_H_
|
||||
#include "third_party/nsync/atomic.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* An nsync_counter represents an unsigned integer that can count up and down,
|
||||
|
@ -37,5 +36,4 @@ uint32_t nsync_counter_value(nsync_counter c);
|
|||
uint32_t nsync_counter_wait(nsync_counter c, nsync_time abs_deadline);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_COUNTER_H_ */
|
||||
|
|
2
third_party/nsync/cv.h
vendored
2
third_party/nsync/cv.h
vendored
|
@ -3,7 +3,6 @@
|
|||
#include "libc/intrin/dll.h"
|
||||
#include "third_party/nsync/mu.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define NSYNC_CV_INIT \
|
||||
|
@ -157,5 +156,4 @@ int nsync_cv_wait_with_deadline_generic(nsync_cv *cv, void *mu,
|
|||
struct nsync_note_s_ *cancel_note);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_CV_H_ */
|
||||
|
|
2
third_party/nsync/debug.h
vendored
2
third_party/nsync/debug.h
vendored
|
@ -2,7 +2,6 @@
|
|||
#define NSYNC_DEBUG_H_
|
||||
#include "third_party/nsync/cv.h"
|
||||
#include "third_party/nsync/mu.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* Debugging operations for mutexes and condition variables.
|
||||
|
@ -35,5 +34,4 @@ char *nsync_mu_debugger(nsync_mu *mu);
|
|||
char *nsync_cv_debugger(nsync_cv *cv);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_DEBUG_H_ */
|
||||
|
|
1
third_party/nsync/futex.c
vendored
1
third_party/nsync/futex.c
vendored
|
@ -53,7 +53,6 @@
|
|||
#include "third_party/nsync/common.internal.h"
|
||||
#include "third_party/nsync/futex.internal.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
// clang-format off
|
||||
|
||||
#define FUTEX_WAIT_BITS_ FUTEX_BITSET_MATCH_ANY
|
||||
|
||||
|
|
2
third_party/nsync/futex.internal.h
vendored
2
third_party/nsync/futex.internal.h
vendored
|
@ -2,12 +2,10 @@
|
|||
#define NSYNC_FUTEX_INTERNAL_H_
|
||||
#include "libc/calls/struct/timespec.h"
|
||||
#include "libc/dce.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int nsync_futex_wake_(_Atomic(int) *, int, char);
|
||||
int nsync_futex_wait_(_Atomic(int) *, int, char, const struct timespec *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_FUTEX_INTERNAL_H_ */
|
||||
|
|
1
third_party/nsync/heap.internal.h
vendored
1
third_party/nsync/heap.internal.h
vendored
|
@ -1,6 +1,5 @@
|
|||
#ifndef NSYNC_TESTING_HEAP_H_
|
||||
#define NSYNC_TESTING_HEAP_H_
|
||||
/* clang-format off */
|
||||
|
||||
/* A heap.
|
||||
Optionally, elements may have storage for the index to allow deletions from
|
||||
|
|
1
third_party/nsync/mem/array.c
vendored
1
third_party/nsync/mem/array.c
vendored
|
@ -18,7 +18,6 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "third_party/nsync/array.internal.h"
|
||||
// clang-format off
|
||||
|
||||
void a_ensure_ (void *v, int delta, int sz) {
|
||||
typedef A_TYPE (void *) a_void_ptr;
|
||||
|
|
1
third_party/nsync/mem/nsync_counter.c
vendored
1
third_party/nsync/mem/nsync_counter.c
vendored
|
@ -31,7 +31,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
/* Internal details of nsync_counter. */
|
||||
struct nsync_counter_s_ {
|
||||
|
|
1
third_party/nsync/mem/nsync_cv.c
vendored
1
third_party/nsync/mem/nsync_cv.c
vendored
|
@ -35,7 +35,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
/* Initialize *cv. */
|
||||
void nsync_cv_init (nsync_cv *cv) {
|
||||
|
|
1
third_party/nsync/mem/nsync_debug.c
vendored
1
third_party/nsync/mem/nsync_debug.c
vendored
|
@ -26,7 +26,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
/* Routines for debugging. */
|
||||
|
||||
|
|
1
third_party/nsync/mem/nsync_mu_wait.c
vendored
1
third_party/nsync/mem/nsync_mu_wait.c
vendored
|
@ -27,7 +27,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
/* Attempt to remove waiter *w from *mu's
|
||||
waiter queue. If successful, leave the lock held in mode *l_type, and
|
||||
|
|
1
third_party/nsync/mem/nsync_note.c
vendored
1
third_party/nsync/mem/nsync_note.c
vendored
|
@ -30,7 +30,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
/* Locking discipline for the nsync_note implementation:
|
||||
|
||||
|
|
1
third_party/nsync/mem/nsync_once.c
vendored
1
third_party/nsync/mem/nsync_once.c
vendored
|
@ -27,7 +27,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
/* An once_sync_s struct contains a lock, and a condition variable on which
|
||||
threads may wait for an nsync_once to be initialized by another thread.
|
||||
|
|
1
third_party/nsync/mem/nsync_sem_wait.c
vendored
1
third_party/nsync/mem/nsync_sem_wait.c
vendored
|
@ -28,7 +28,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
/* Wait until one of:
|
||||
w->sem is non-zero----decrement it and return 0.
|
||||
|
|
1
third_party/nsync/mem/nsync_wait.c
vendored
1
third_party/nsync/mem/nsync_wait.c
vendored
|
@ -30,7 +30,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
int nsync_wait_n (void *mu, void (*lock) (void *), void (*unlock) (void *),
|
||||
nsync_time abs_deadline,
|
||||
|
|
1
third_party/nsync/mu.c
vendored
1
third_party/nsync/mu.c
vendored
|
@ -28,7 +28,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
/* Initialize *mu. */
|
||||
void nsync_mu_init (nsync_mu *mu) {
|
||||
|
|
2
third_party/nsync/mu.h
vendored
2
third_party/nsync/mu.h
vendored
|
@ -2,7 +2,6 @@
|
|||
#define NSYNC_MU_H_
|
||||
#include "libc/intrin/dll.h"
|
||||
#include "third_party/nsync/atomic.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* An nsync_mu is a lock. If initialized to zero, it's valid and unlocked.
|
||||
|
@ -99,5 +98,4 @@ void nsync_mu_rassert_held(const nsync_mu *mu);
|
|||
int nsync_mu_is_reader(const nsync_mu *mu);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_MU_H_ */
|
||||
|
|
1
third_party/nsync/mu_semaphore.c
vendored
1
third_party/nsync/mu_semaphore.c
vendored
|
@ -29,7 +29,6 @@ asm(".ident\t\"\\n\\n\
|
|||
*NSYNC (Apache 2.0)\\n\
|
||||
Copyright 2016 Google, Inc.\\n\
|
||||
https://github.com/google/nsync\"");
|
||||
// clang-format off
|
||||
|
||||
/* Initialize *s; the initial value is 0. */
|
||||
void nsync_mu_semaphore_init (nsync_semaphore *s) {
|
||||
|
|
2
third_party/nsync/mu_semaphore.h
vendored
2
third_party/nsync/mu_semaphore.h
vendored
|
@ -1,7 +1,6 @@
|
|||
#ifndef NSYNC_SEM_H_
|
||||
#define NSYNC_SEM_H_
|
||||
#include "third_party/nsync/time.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
typedef struct nsync_semaphore_s_ {
|
||||
|
@ -24,5 +23,4 @@ errno_t nsync_mu_semaphore_p_with_deadline(nsync_semaphore *s,
|
|||
void nsync_mu_semaphore_v(nsync_semaphore *s);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_SEM_H_ */
|
||||
|
|
2
third_party/nsync/mu_semaphore.internal.h
vendored
2
third_party/nsync/mu_semaphore.internal.h
vendored
|
@ -2,7 +2,6 @@
|
|||
#define COSMOPOLITAN_THIRD_PARTY_NSYNC_MU_SEMAPHORE_INTERNAL_H_
|
||||
#include "third_party/nsync/mu_semaphore.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
void nsync_mu_semaphore_init_futex(nsync_semaphore *);
|
||||
|
@ -21,5 +20,4 @@ errno_t nsync_mu_semaphore_p_with_deadline_gcd(nsync_semaphore *, nsync_time);
|
|||
void nsync_mu_semaphore_v_gcd(nsync_semaphore *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_THIRD_PARTY_NSYNC_MU_SEMAPHORE_INTERNAL_H_ */
|
||||
|
|
1
third_party/nsync/mu_semaphore_futex.c
vendored
1
third_party/nsync/mu_semaphore_futex.c
vendored
|
@ -23,7 +23,6 @@
|
|||
#include "third_party/nsync/atomic.internal.h"
|
||||
#include "third_party/nsync/futex.internal.h"
|
||||
#include "third_party/nsync/mu_semaphore.internal.h"
|
||||
// clang-format off
|
||||
|
||||
/**
|
||||
* @fileoverview Semaphores w/ Linux Futexes API.
|
||||
|
|
1
third_party/nsync/mu_semaphore_gcd.c
vendored
1
third_party/nsync/mu_semaphore_gcd.c
vendored
|
@ -31,7 +31,6 @@
|
|||
#include "third_party/nsync/futex.internal.h"
|
||||
#include "third_party/nsync/mu_semaphore.internal.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
// clang-format off
|
||||
|
||||
/**
|
||||
* @fileoverview Semaphores w/ Apple's Grand Central Dispatch API.
|
||||
|
|
1
third_party/nsync/mu_semaphore_sem.c
vendored
1
third_party/nsync/mu_semaphore_sem.c
vendored
|
@ -32,7 +32,6 @@
|
|||
#include "libc/thread/thread.h"
|
||||
#include "third_party/nsync/mu_semaphore.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
// clang-format off
|
||||
|
||||
/**
|
||||
* @fileoverview Semaphores w/ POSIX Semaphores API.
|
||||
|
|
2
third_party/nsync/mu_wait.h
vendored
2
third_party/nsync/mu_wait.h
vendored
|
@ -2,7 +2,6 @@
|
|||
#define NSYNC_MU_WAIT_H_
|
||||
#include "third_party/nsync/mu.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* nsync_mu_wait() and nsync_mu_wait_with_deadline() can be used instead
|
||||
|
@ -114,5 +113,4 @@ int nsync_mu_wait_with_deadline(
|
|||
void nsync_mu_unlock_without_wakeup(nsync_mu *mu);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_MU_WAIT_H_ */
|
||||
|
|
2
third_party/nsync/note.h
vendored
2
third_party/nsync/note.h
vendored
|
@ -1,7 +1,6 @@
|
|||
#ifndef NSYNC_NOTE_H_
|
||||
#define NSYNC_NOTE_H_
|
||||
#include "third_party/nsync/time.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* An nsync_note represents a single bit that can transition from 0 to 1
|
||||
|
@ -47,5 +46,4 @@ int nsync_note_wait(nsync_note n, nsync_time abs_deadline);
|
|||
nsync_time nsync_note_expiry(nsync_note n);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_NOTE_H_ */
|
||||
|
|
2
third_party/nsync/once.h
vendored
2
third_party/nsync/once.h
vendored
|
@ -1,7 +1,6 @@
|
|||
#ifndef NSYNC_ONCE_H_
|
||||
#define NSYNC_ONCE_H_
|
||||
#include "third_party/nsync/atomic.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* An nsync_once allows a function to be called exactly once, when first
|
||||
|
@ -33,5 +32,4 @@ void nsync_run_once_arg_spin(nsync_once *once, void (*farg)(void *arg),
|
|||
void *arg);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_ONCE_H_ */
|
||||
|
|
1
third_party/nsync/panic.c
vendored
1
third_party/nsync/panic.c
vendored
|
@ -21,7 +21,6 @@
|
|||
#include "libc/intrin/describebacktrace.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "third_party/nsync/common.internal.h"
|
||||
// clang-format off
|
||||
|
||||
/* Aborts after printing the nul-terminated string s[]. */
|
||||
void nsync_panic_ (const char *s) {
|
||||
|
|
2
third_party/nsync/races.internal.h
vendored
2
third_party/nsync/races.internal.h
vendored
|
@ -1,6 +1,5 @@
|
|||
#ifndef COSMOPOLITAN_THIRD_PARTY_NSYNC_RACES_INTERNAL_H_
|
||||
#define COSMOPOLITAN_THIRD_PARTY_NSYNC_RACES_INTERNAL_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* Annotations for race detectors. */
|
||||
|
@ -32,5 +31,4 @@ NSYNC_C_END_
|
|||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_THIRD_PARTY_NSYNC_RACES_INTERNAL_H_ */
|
||||
|
|
1
third_party/nsync/testing/atm_log.c
vendored
1
third_party/nsync/testing/atm_log.c
vendored
|
@ -18,7 +18,6 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/thread/thread.h"
|
||||
// clang-format off
|
||||
|
||||
#ifndef NSYNC_ATM_LOG
|
||||
#define NSYNC_ATM_LOG 0
|
||||
|
|
1
third_party/nsync/testing/closure.c
vendored
1
third_party/nsync/testing/closure.c
vendored
|
@ -16,7 +16,6 @@
|
|||
│ limitations under the License. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/nsync/testing/closure.h"
|
||||
// clang-format off
|
||||
|
||||
void nsync_start_thread_ (void (*f) (void *), void *arg);
|
||||
|
||||
|
|
1
third_party/nsync/testing/closure.h
vendored
1
third_party/nsync/testing/closure.h
vendored
|
@ -1,6 +1,5 @@
|
|||
#ifndef NSYNC_TESTING_CLOSURE_H_
|
||||
#define NSYNC_TESTING_CLOSURE_H_
|
||||
/* clang-format off */
|
||||
#include "libc/mem/mem.h"
|
||||
|
||||
/* A run-once, self-freeing closure. */
|
||||
|
|
1
third_party/nsync/testing/counter_test.c
vendored
1
third_party/nsync/testing/counter_test.c
vendored
|
@ -20,7 +20,6 @@
|
|||
#include "third_party/nsync/testing/smprintf.h"
|
||||
#include "third_party/nsync/testing/testing.h"
|
||||
#include "third_party/nsync/testing/time_extra.h"
|
||||
// clang-format off
|
||||
|
||||
/* Verify the properties of a zero counter. */
|
||||
static void test_counter_zero (testing t) {
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "third_party/nsync/testing/closure.h"
|
||||
#include "third_party/nsync/testing/smprintf.h"
|
||||
#include "third_party/nsync/testing/testing.h"
|
||||
// clang-format off
|
||||
|
||||
/* A cv_stress_data represents the data used by the threads of the tests below. */
|
||||
typedef struct cv_stress_data_s {
|
||||
|
|
1
third_party/nsync/testing/cv_test.c
vendored
1
third_party/nsync/testing/cv_test.c
vendored
|
@ -30,7 +30,6 @@
|
|||
#include "third_party/nsync/testing/testing.h"
|
||||
#include "third_party/nsync/testing/time_extra.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
// clang-format off
|
||||
|
||||
/* --------------------------- */
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "third_party/nsync/testing/smprintf.h"
|
||||
#include "third_party/nsync/testing/testing.h"
|
||||
#include "third_party/nsync/testing/time_extra.h"
|
||||
// clang-format off
|
||||
|
||||
/* Example use of CV.wait(): A priority queue of strings whose
|
||||
"remove_with_deadline" operation has a deadline. */
|
||||
|
|
1
third_party/nsync/testing/dll_test.c
vendored
1
third_party/nsync/testing/dll_test.c
vendored
|
@ -22,7 +22,6 @@
|
|||
#include "third_party/nsync/array.internal.h"
|
||||
#include "third_party/nsync/testing/smprintf.h"
|
||||
#include "third_party/nsync/testing/testing.h"
|
||||
// clang-format off
|
||||
|
||||
/* This tests internal abstractions. */
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "third_party/nsync/testing/testing.h"
|
||||
#include "third_party/nsync/testing/time_extra.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
// clang-format off
|
||||
|
||||
/* Test the behaviour of mu in situations where starvation might be expected. */
|
||||
|
||||
|
|
1
third_party/nsync/testing/mu_test.c
vendored
1
third_party/nsync/testing/mu_test.c
vendored
|
@ -25,7 +25,6 @@
|
|||
#include "third_party/nsync/testing/smprintf.h"
|
||||
#include "third_party/nsync/testing/testing.h"
|
||||
#include "third_party/nsync/testing/time_extra.h"
|
||||
// clang-format off
|
||||
|
||||
/* The state shared between the threads in each of the tests below. */
|
||||
typedef struct test_data_s {
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "third_party/nsync/testing/smprintf.h"
|
||||
#include "third_party/nsync/testing/testing.h"
|
||||
#include "third_party/nsync/testing/time_extra.h"
|
||||
// clang-format off
|
||||
|
||||
/* Example use of nsync_mu_wait(): A priority queue of strings whose
|
||||
"remove_with_deadline" operation has a deadline. */
|
||||
|
|
1
third_party/nsync/testing/mu_wait_test.c
vendored
1
third_party/nsync/testing/mu_wait_test.c
vendored
|
@ -25,7 +25,6 @@
|
|||
#include "third_party/nsync/testing/testing.h"
|
||||
#include "third_party/nsync/testing/time_extra.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
// clang-format off
|
||||
|
||||
/* --------------------------- */
|
||||
|
||||
|
|
1
third_party/nsync/testing/note_test.c
vendored
1
third_party/nsync/testing/note_test.c
vendored
|
@ -21,7 +21,6 @@
|
|||
#include "third_party/nsync/testing/testing.h"
|
||||
#include "third_party/nsync/testing/time_extra.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
// clang-format off
|
||||
|
||||
/* Verify the properties of a prenotified note. */
|
||||
static void test_note_prenotified (testing t) {
|
||||
|
|
1
third_party/nsync/testing/once_test.c
vendored
1
third_party/nsync/testing/once_test.c
vendored
|
@ -23,7 +23,6 @@
|
|||
#include "third_party/nsync/testing/closure.h"
|
||||
#include "third_party/nsync/testing/smprintf.h"
|
||||
#include "third_party/nsync/testing/testing.h"
|
||||
// clang-format off
|
||||
|
||||
/* This tests nsync_once */
|
||||
|
||||
|
|
1
third_party/nsync/testing/pingpong_test.c
vendored
1
third_party/nsync/testing/pingpong_test.c
vendored
|
@ -27,7 +27,6 @@
|
|||
#include "third_party/nsync/testing/smprintf.h"
|
||||
#include "third_party/nsync/testing/testing.h"
|
||||
#include "third_party/nsync/waiter.h"
|
||||
// clang-format off
|
||||
|
||||
/* The benchmarks in this file use various mechanisms to
|
||||
ping-pong back and forth between two threads as they count i from
|
||||
|
|
1
third_party/nsync/testing/smprintf.c
vendored
1
third_party/nsync/testing/smprintf.c
vendored
|
@ -19,7 +19,6 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
// clang-format off
|
||||
|
||||
char *smprintf (const char *fmt, ...) {
|
||||
int m = strlen (fmt) * 2 + 1;
|
||||
|
|
1
third_party/nsync/testing/start_thread.c
vendored
1
third_party/nsync/testing/start_thread.c
vendored
|
@ -17,7 +17,6 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/thread/thread.h"
|
||||
// clang-format off
|
||||
|
||||
struct thd_args {
|
||||
void (*f) (void *);
|
||||
|
|
1
third_party/nsync/testing/testing.c
vendored
1
third_party/nsync/testing/testing.c
vendored
|
@ -33,7 +33,6 @@
|
|||
#include "third_party/nsync/testing/closure.h"
|
||||
#include "third_party/nsync/testing/smprintf.h"
|
||||
#include "third_party/nsync/testing/time_extra.h"
|
||||
// clang-format off
|
||||
|
||||
struct testing_base_s {
|
||||
int flags; /* flags from testing_new(); r/o after init */
|
||||
|
|
1
third_party/nsync/testing/testing.h
vendored
1
third_party/nsync/testing/testing.h
vendored
|
@ -1,6 +1,5 @@
|
|||
#ifndef NSYNC_TESTING_TESTING_H_
|
||||
#define NSYNC_TESTING_TESTING_H_
|
||||
/* clang-format off */
|
||||
|
||||
typedef struct testing_base_s *testing_base;
|
||||
typedef const struct testing_base_s *const_testing_base;
|
||||
|
|
1
third_party/nsync/testing/time_extra.c
vendored
1
third_party/nsync/testing/time_extra.c
vendored
|
@ -20,7 +20,6 @@
|
|||
#include "third_party/nsync/testing/smprintf.h"
|
||||
#include "third_party/nsync/testing/time_extra.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
// clang-format off
|
||||
|
||||
char *nsync_time_str (nsync_time t, int decimals) {
|
||||
static const struct {
|
||||
|
|
1
third_party/nsync/testing/wait_test.c
vendored
1
third_party/nsync/testing/wait_test.c
vendored
|
@ -25,7 +25,6 @@
|
|||
#include "third_party/nsync/testing/time_extra.h"
|
||||
#include "third_party/nsync/time.h"
|
||||
#include "third_party/nsync/waiter.h"
|
||||
// clang-format off
|
||||
|
||||
static void decrement_at (nsync_counter c, nsync_time abs_deadline, nsync_counter done) {
|
||||
nsync_time_sleep_until (abs_deadline);
|
||||
|
|
2
third_party/nsync/time.h
vendored
2
third_party/nsync/time.h
vendored
|
@ -1,7 +1,6 @@
|
|||
#ifndef NSYNC_TIME_H_
|
||||
#define NSYNC_TIME_H_
|
||||
#include "libc/calls/struct/timespec.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define NSYNC_TIME_SEC(t) ((t).tv_sec)
|
||||
|
@ -56,5 +55,4 @@ typedef struct timespec nsync_time;
|
|||
#define nsync_time_s_ns(s, ns) ((nsync_time){(int64_t)(s), (unsigned)(ns)})
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_TIME_H_ */
|
||||
|
|
2
third_party/nsync/wait_s.internal.h
vendored
2
third_party/nsync/wait_s.internal.h
vendored
|
@ -2,7 +2,6 @@
|
|||
#define COSMOPOLITAN_LIBC_THREAD_WAIT_INTERNAL_H_
|
||||
#include "libc/intrin/dll.h"
|
||||
#include "third_party/nsync/atomic.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* Implementations of "struct nsync_waitable_s" must provide functions
|
||||
|
@ -24,5 +23,4 @@ struct nsync_waiter_s {
|
|||
void nsync_waiter_destroy(void *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_THREAD_WAIT_INTERNAL_H_ */
|
||||
|
|
2
third_party/nsync/waiter.h
vendored
2
third_party/nsync/waiter.h
vendored
|
@ -1,7 +1,6 @@
|
|||
#ifndef NSYNC_WAITER_H_
|
||||
#define NSYNC_WAITER_H_
|
||||
#include "third_party/nsync/time.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/* nsync_wait_n() allows the client to wait on multiple objects
|
||||
|
@ -134,5 +133,4 @@ extern const struct nsync_waitable_funcs_s nsync_counter_waitable_funcs;
|
|||
extern const struct nsync_waitable_funcs_s nsync_cv_waitable_funcs;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* NSYNC_WAITER_H_ */
|
||||
|
|
1
third_party/nsync/yield.c
vendored
1
third_party/nsync/yield.c
vendored
|
@ -20,7 +20,6 @@
|
|||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "third_party/nsync/common.internal.h"
|
||||
// clang-format off
|
||||
|
||||
void nsync_yield_ (void) {
|
||||
pthread_yield ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue