cosmopolitan/third_party/nsync
Justine Tunney ff77f2a6af
Make improvements
- This change fixes a bug that allowed unbuffered printf() output (to
  streams like stderr) to be truncated. This regression was introduced
  some time between now and the last release.

- POSIX specifies all functions as thread safe by default. This change
  works towards cleaning up our use of the @threadsafe / @threadunsafe
  documentation annotations to reflect that. The goal is (1) to use
  @threadunsafe to document functions which POSIX say needn't be thread
  safe, and (2) use @threadsafe to document functions that we chose to
  implement as thread safe even though POSIX didn't mandate it.

- Tidy up the clock_gettime() implementation. We're now trying out a
  cleaner approach to system call support that aims to maintain the
  Linux errno convention as long as possible. This also fixes bugs that
  existed previously, where the vDSO errno wasn't being translated
  properly. The gettimeofday() system call is now a wrapper for
  clock_gettime(), which reduces bloat in apps that use both.

- The recently-introduced improvements to the execute bit on Windows has
  had bugs fixed. access(X_OK) on a directory on Windows now succeeds.
  fstat() will now perform the MZ/#! ReadFile() operation correctly.

- Windows.h is no longer included in libc/isystem/, because it confused
  PCRE's build system into thinking Cosmopolitan is a WIN32 platform.
  Cosmo's Windows.h polyfill was never even really that good, since it
  only defines a subset of the subset of WIN32 APIs that Cosmo defines.

- The setlongerjmp() / longerjmp() APIs are removed. While they're nice
  APIs that are superior to the standardized setjmp / longjmp functions,
  they weren't superior enough to not be dead code in the monorepo. If
  you use these APIs, please file an issue and they'll be restored.

- The .com appending magic has now been removed from APE Loader.
2023-10-03 06:17:16 -07:00
..
mem Make improvements 2023-09-18 21:04:47 -07:00
testing Make improvements 2023-09-18 21:04:47 -07:00
array.internal.h Clean up some sleep code 2022-10-08 03:00:48 -07:00
atomic.h Validate privileged code relationships 2023-06-08 04:38:06 -07:00
atomic.internal.h Add shared memory apis to redbean 2022-10-06 04:55:26 -07:00
common.c Get rid of kmalloc() 2023-09-11 21:56:00 -07:00
common.internal.h Get rid of kmalloc() 2023-09-11 21:56:00 -07:00
compat.S Make improvements 2023-06-15 14:50:53 -07:00
counter.h Clean up more code 2023-07-06 08:03:24 -07:00
cv.h Clean up more code 2023-07-06 08:03:24 -07:00
debug.h Use *NSYNC for POSIX threads locking APIs 2022-09-11 11:04:50 -07:00
futex.c Make improvements 2023-10-03 06:17:16 -07:00
futex.internal.h Fix warnings 2023-09-01 20:50:18 -07:00
heap.internal.h Clean up some sleep code 2022-10-08 03:00:48 -07:00
LICENSE.txt Use *NSYNC for POSIX threads locking APIs 2022-09-11 11:04:50 -07:00
mu.c Get rid of kmalloc() 2023-09-11 21:56:00 -07:00
mu.h Clean up more code 2023-07-06 08:03:24 -07:00
mu_semaphore.c Make improvements 2023-09-18 21:04:47 -07:00
mu_semaphore.h Get rid of kmalloc() 2023-09-11 21:56:00 -07:00
mu_semaphore.internal.h Get rid of kmalloc() 2023-09-11 21:56:00 -07:00
mu_semaphore_futex.c Make improvements 2023-09-18 21:04:47 -07:00
mu_semaphore_gcd.c Make improvements 2023-09-18 21:04:47 -07:00
mu_semaphore_sem.c Make improvements 2023-09-18 21:04:47 -07:00
mu_wait.h Use *NSYNC for POSIX threads locking APIs 2022-09-11 11:04:50 -07:00
note.h Use *NSYNC for POSIX threads locking APIs 2022-09-11 11:04:50 -07:00
nsync.mk Make improvements 2023-09-18 21:04:47 -07:00
once.h Use *NSYNC for POSIX threads locking APIs 2022-09-11 11:04:50 -07:00
panic.c Remove some dead code 2023-07-03 02:48:29 -07:00
races.internal.h Add *NSYNC mu_test 2022-09-11 18:56:29 -07:00
README.cosmo Make improvements 2023-09-18 21:04:47 -07:00
README.md Add *NSYNC to libc/isystem 2022-09-13 01:47:12 -07:00
time.h Improve cancellations, randomness, and time 2022-11-05 23:45:32 -07:00
wait_s.internal.h Clean up more code 2023-07-06 08:03:24 -07:00
waiter.h Use *NSYNC for POSIX threads locking APIs 2022-09-11 11:04:50 -07:00
yield.c Make improvements 2023-09-18 21:04:47 -07:00

*NSYNC

*NSYNC is a library providing scalable synchronization primitives. The following packages are provided:

  • THIRD_PARTY_NSYNC has nsync_mu which doesn't depend on malloc().
  • THIRD_PARTY_NSYNC_MEM has the rest of *NSYNC, e.g. nsync_cv.

The origin of this code is here:

git@github.com:google/nsync
ac5489682760393fe21bd2a8e038b528442412a7 (1.25.0)
Author: Mike Burrows <m3b@google.com>
Date:   Wed Jun 1 16:47:52 2022 -0700

NSYNC uses the Apache 2.0 license. We made the following local changes:

  • Write custom nsync_malloc_() so malloc() can use *NSYNC.

  • Rewrite futex() wrapper to support old Linux kernels and OpenBSD.

  • Normalize sources to Cosmopolitan style conventions; *NSYNC upstream supports dozens of compilers and operating systems, at compile-time. Since Cosmo solves portability at runtime instead, most of the build config toil has been removed, in order to help the NSYNC source code be more readable and hackable.