cosmopolitan/test/libc/thread
Justine Tunney 98c5847727
Fix fork waiter leak in nsync
This change fixes a bug where nsync waiter objects would leak. It'd mean
that long-running programs like runitd would run out of file descriptors
on NetBSD where waiter objects have ksem file descriptors. On other OSes
this bug is mostly harmless since the worst that can happen with a futex
is to leak a little bit of ram. The bug was caused because tib_nsync was
sneaking back in after the finalization code had cleared it. This change
refactors the thread exiting code to handle nsync teardown appropriately
and in making this change I found another issue, which is that user code
which is buggy, and tries to exit without joining joinable threads which
haven't been detached, would result in a deadlock. That doesn't sound so
bad, except the main thread is a joinable thread. So this deadlock would
be triggered in ways that put libc at fault. So we now auto-join threads
and libc will log a warning to --strace when that happens for any thread
2024-12-31 01:30:13 -08:00
..
async_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
BUILD.mk Strongly link glob() into system() and popen() 2024-11-15 20:37:34 -08:00
footek_test.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
makecontext_test.c Release Cosmopolitan v3.6.0 2024-07-23 03:28:19 -07:00
nsync_test.c Introduce pthread_condattr_setclock() 2024-09-02 23:45:42 -07:00
pthread_atfork_test.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
pthread_attr_setsigmask_np_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
pthread_barrier_wait_test.c Bring back gc() function 2024-01-08 10:26:28 -08:00
pthread_cancel_deferred_cond_test.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
pthread_cancel_masked_cond_test.c Improve multithreading 2024-07-21 14:40:45 -07:00
pthread_cancel_masked_read_test.c Improve multithreading 2024-07-21 14:40:45 -07:00
pthread_cancel_test.c Reduce stack virtual memory consumption on Linux 2024-12-25 20:58:08 -08:00
pthread_cond_signal_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
pthread_cond_timedwait_test.c Introduce pthread_condattr_setclock() 2024-09-02 23:45:42 -07:00
pthread_create_inherit_mask_test.c Improve multithreading 2024-07-21 14:40:45 -07:00
pthread_create_test.c Fix fork waiter leak in nsync 2024-12-31 01:30:13 -08:00
pthread_detach_test.c Improve multithreading 2024-07-21 14:40:45 -07:00
pthread_exit_test.c Get rid of .internal.h convention in LIBC_INTRIN 2024-07-19 19:38:00 -07:00
pthread_getunique_np_test.c Make POSIX threads improvements 2024-06-30 15:38:59 -07:00
pthread_key_create_test.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
pthread_kill_test.c Fix fork waiter leak in nsync 2024-12-31 01:30:13 -08:00
pthread_rwlock_rdlock_test.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
pthread_setname_np_test.c Apply clang-format update to repo (#1154) 2024-04-25 10:38:00 -07:00
pthread_spin_lock_test.c Allow user to override pthread mutex and cond 2024-12-23 21:57:52 -08:00
sem_open_test.c Bring back gc() function 2024-01-08 10:26:28 -08:00
sem_timedwait_test.c Make realloc() go 100x faster on Linux/NetBSD 2024-07-07 12:40:30 -07:00
setitimer_test.c Eliminate cyclic locks in runtime 2024-12-16 22:25:12 -08:00
tls_dtor_test.cc vim spells the c++ filetype 'cpp' 2024-04-24 13:56:37 -07:00