Improve pthread_join()

Since we're now on Windows 8, we can have clone() work as advertised on
Windows, where it sends a futex wake to the child tid. It's also likely
we no longer need to work around thread flakes on OpenBSD, in _wait0().
This commit is contained in:
Justine Tunney 2022-09-16 14:02:06 -07:00
parent 3733b43a8f
commit 994e1f4386
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
19 changed files with 154 additions and 74 deletions

View file

@ -177,19 +177,19 @@ extern const errno_t EBUSY;
#define pthread_spin_lock(pSpin) \
({ \
pthread_spinlock_t *_s = pSpin; \
while (__atomic_test_and_set(&_s->_lock, __ATOMIC_SEQ_CST)) donothing; \
while (__atomic_test_and_set(&_s->_lock, __ATOMIC_ACQUIRE)) donothing; \
0; \
})
#define pthread_spin_unlock(pSpin) \
({ \
pthread_spinlock_t *_s = pSpin; \
__atomic_store_n(&_s->_lock, 0, __ATOMIC_RELAXED); \
__atomic_store_n(&_s->_lock, 0, __ATOMIC_RELEASE); \
0; \
})
#define pthread_spin_trylock(pSpin) \
({ \
pthread_spinlock_t *_s = pSpin; \
__atomic_test_and_set(&_s->_lock, __ATOMIC_SEQ_CST) ? EBUSY : 0; \
__atomic_test_and_set(&_s->_lock, __ATOMIC_ACQUIRE) ? EBUSY : 0; \
})
#endif /* GCC 4.7+ */