mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Make POSIX threads improvements
- Ensure SIGTHR isn't blocked in newly created threads - Use TIB rather than thread_local for thread atexits - Make POSIX thread keys atomic within thread - Don't bother logging prctl() to --strace - Log thread destructor names to --strace
This commit is contained in:
parent
387310c659
commit
76957983cf
11 changed files with 57 additions and 71 deletions
|
@ -48,9 +48,9 @@ int pthread_key_create(pthread_key_t *key, pthread_key_dtor dtor) {
|
|||
if (!dtor)
|
||||
dtor = (pthread_key_dtor)-1;
|
||||
for (i = 0; i < PTHREAD_KEYS_MAX; ++i) {
|
||||
if (!(expect = atomic_load_explicit(_pthread_key_dtor + i,
|
||||
memory_order_acquire)) &&
|
||||
atomic_compare_exchange_strong_explicit(_pthread_key_dtor + i, &expect,
|
||||
if (!(expect = atomic_load_explicit(&_pthread_key_dtor[i],
|
||||
memory_order_relaxed)) &&
|
||||
atomic_compare_exchange_strong_explicit(&_pthread_key_dtor[i], &expect,
|
||||
dtor, memory_order_release,
|
||||
memory_order_relaxed)) {
|
||||
*key = i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue