Upgrade to 2022-era LLVM LIBCXX

This commit is contained in:
Justine Tunney 2024-05-27 02:12:27 -07:00
parent 2f4ca71f26
commit 8e68384e15
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2078 changed files with 165657 additions and 65010 deletions

View file

@ -75,14 +75,13 @@ void _pthread_free(struct PosixThread *pt, bool isfork) {
unassert(!munmap(pt->pt_attr.__stackaddr, pt->pt_attr.__stacksize));
}
if (!isfork) {
if (IsWindows()) {
if (pt->tib->tib_syshand) {
unassert(CloseHandle(pt->tib->tib_syshand));
}
} else if (IsXnuSilicon()) {
if (pt->tib->tib_syshand) {
__syslib->__pthread_join(pt->tib->tib_syshand, 0);
}
uint64_t syshand =
atomic_load_explicit(&pt->tib->tib_syshand, memory_order_acquire);
if (syshand) {
if (IsWindows())
unassert(CloseHandle(syshand));
else if (IsXnuSilicon())
__syslib->__pthread_join(syshand, 0);
}
}
free(pt->pt_tls);

View file

@ -164,7 +164,8 @@ wontreturn void pthread_exit(void *rc) {
// note that the main thread is joinable by child threads
if (pt->pt_flags & PT_STATIC) {
atomic_store_explicit(&tib->tib_tid, 0, memory_order_release);
nsync_futex_wake_(&tib->tib_tid, INT_MAX, !IsWindows() && !IsXnu());
nsync_futex_wake_((atomic_int *)&tib->tib_tid, INT_MAX,
!IsWindows() && !IsXnu());
_Exit1(0);
}

View file

@ -44,8 +44,7 @@ COSMOPOLITAN_C_START_
#define PTHREAD_COND_INITIALIZER _PTHREAD_INIT
#define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_INIT
#define PTHREAD_MUTEX_INITIALIZER _PTHREAD_INIT
#define _PTHREAD_INIT \
{ 0 }
#define _PTHREAD_INIT {0}
typedef uintptr_t pthread_t;
typedef int pthread_id_np_t;