summaryrefslogtreecommitdiff
path: root/src/thread/pthread_key_create.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2019-02-16 11:44:07 -0500
committerRich Felker <dalias@aerifal.cx>2019-02-16 11:44:07 -0500
commit639bcf251e549f634da9a3e7ef8528eb2ec12505 (patch)
tree799fe258d444002e5f04c619e43cd46a0db94287 /src/thread/pthread_key_create.c
parentba74a42cee90c9a4425188a021b6ad8ba80b9468 (diff)
downloadmusl-639bcf251e549f634da9a3e7ef8528eb2ec12505.tar.gz
introduce namespace-safe rwlock aliases; use in pthread_key_create
commit 84d061d5a31c9c773e29e1e2b1ffe8cb9557bc58 inadvertently introduced namespace violations by using the pthread-namespace rwlock functions in pthread_key_create, which is in turn used for C11 tss. fix that and possible future uses of rwlocks elsewhere.
Diffstat (limited to 'src/thread/pthread_key_create.c')
-rw-r--r--src/thread/pthread_key_create.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/thread/pthread_key_create.c b/src/thread/pthread_key_create.c
index da1fb116..dc20cc3f 100644
--- a/src/thread/pthread_key_create.c
+++ b/src/thread/pthread_key_create.c
@@ -32,16 +32,16 @@ int __pthread_key_create(pthread_key_t *k, void (*dtor)(void *))
/* Purely a sentinel value since null means slot is free. */
if (!dtor) dtor = nodtor;
- pthread_rwlock_wrlock(&key_lock);
+ __pthread_rwlock_wrlock(&key_lock);
do {
if (!keys[j]) {
keys[next_key = *k = j] = dtor;
- pthread_rwlock_unlock(&key_lock);
+ __pthread_rwlock_unlock(&key_lock);
return 0;
}
} while ((j=(j+1)%PTHREAD_KEYS_MAX) != next_key);
- pthread_rwlock_unlock(&key_lock);
+ __pthread_rwlock_unlock(&key_lock);
return EAGAIN;
}
@@ -57,9 +57,9 @@ int __pthread_key_delete(pthread_key_t k)
__tl_unlock();
__restore_sigs(&set);
- pthread_rwlock_wrlock(&key_lock);
+ __pthread_rwlock_wrlock(&key_lock);
keys[k] = 0;
- pthread_rwlock_unlock(&key_lock);
+ __pthread_rwlock_unlock(&key_lock);
return 0;
}
@@ -69,19 +69,19 @@ void __pthread_tsd_run_dtors()
pthread_t self = __pthread_self();
int i, j;
for (j=0; self->tsd_used && j<PTHREAD_DESTRUCTOR_ITERATIONS; j++) {
- pthread_rwlock_rdlock(&key_lock);
+ __pthread_rwlock_rdlock(&key_lock);
self->tsd_used = 0;
for (i=0; i<PTHREAD_KEYS_MAX; i++) {
void *val = self->tsd[i];
void (*dtor)(void *) = keys[i];
self->tsd[i] = 0;
if (val && dtor && dtor != nodtor) {
- pthread_rwlock_unlock(&key_lock);
+ __pthread_rwlock_unlock(&key_lock);
dtor(val);
- pthread_rwlock_rdlock(&key_lock);
+ __pthread_rwlock_rdlock(&key_lock);
}
}
- pthread_rwlock_unlock(&key_lock);
+ __pthread_rwlock_unlock(&key_lock);
}
}