diff options
author | Michal Mazurek <akfaew@cvs.openbsd.org> | 2016-09-04 10:13:36 +0000 |
---|---|---|
committer | Michal Mazurek <akfaew@cvs.openbsd.org> | 2016-09-04 10:13:36 +0000 |
commit | cde88094571e96bd76549770cf9b998247169cd5 (patch) | |
tree | 2a60ee0b9bd8b8b62833c34288fe01bf90d2acbf /lib | |
parent | 9ee1df45f4cb38d1a6b24bd00140a2c3815527d9 (diff) |
Get rid of ticket support, replace "struct _spinlock" with "_atomic_lock_t".
ok tedu@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/librthread/rthread.c | 34 | ||||
-rw-r--r-- | lib/librthread/rthread.h | 36 | ||||
-rw-r--r-- | lib/librthread/rthread_file.c | 7 | ||||
-rw-r--r-- | lib/librthread/rthread_fork.c | 8 | ||||
-rw-r--r-- | lib/librthread/rthread_libc.c | 11 | ||||
-rw-r--r-- | lib/librthread/rthread_rwlock.c | 12 | ||||
-rw-r--r-- | lib/librthread/rthread_sem.c | 8 | ||||
-rw-r--r-- | lib/librthread/rthread_spin_lock.c | 4 | ||||
-rw-r--r-- | lib/librthread/rthread_stack.c | 5 | ||||
-rw-r--r-- | lib/librthread/rthread_sync.c | 17 | ||||
-rw-r--r-- | lib/librthread/rthread_tls.c | 4 |
11 files changed, 64 insertions, 82 deletions
diff --git a/lib/librthread/rthread.c b/lib/librthread/rthread.c index 8995c6b7496..b2e5e7ea86b 100644 --- a/lib/librthread/rthread.c +++ b/lib/librthread/rthread.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread.c,v 1.93 2016/09/03 16:44:20 akfaew Exp $ */ +/* $OpenBSD: rthread.c,v 1.94 2016/09/04 10:13:35 akfaew Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org> * All Rights Reserved. @@ -63,15 +63,13 @@ REDIRECT_SYSCALL(thrkill); static int concurrency_level; /* not used */ -struct _spinlock _SPINLOCK_UNLOCKED_ASSIGN = _SPINLOCK_UNLOCKED; - int _threads_ready; size_t _thread_pagesize; struct listhead _thread_list = LIST_HEAD_INITIALIZER(_thread_list); -struct _spinlock _thread_lock = _SPINLOCK_UNLOCKED; +_atomic_lock_t _thread_lock = _SPINLOCK_UNLOCKED; static struct pthread_queue _thread_gc_list = TAILQ_HEAD_INITIALIZER(_thread_gc_list); -static struct _spinlock _thread_gc_lock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t _thread_gc_lock = _SPINLOCK_UNLOCKED; static struct pthread _initial_thread; struct pthread_attr _rthread_attr_default = { @@ -89,22 +87,22 @@ struct pthread_attr _rthread_attr_default = { * internal support functions */ void -_spinlock(volatile struct _spinlock *lock) +_spinlock(volatile _atomic_lock_t *lock) { - while (_atomic_lock(&lock->ticket)) + while (_atomic_lock(lock)) sched_yield(); } int -_spinlocktry(volatile struct _spinlock *lock) +_spinlocktry(volatile _atomic_lock_t *lock) { - return 0 == _atomic_lock(&lock->ticket); + return 0 == _atomic_lock(lock); } void -_spinunlock(volatile struct _spinlock *lock) +_spinunlock(volatile _atomic_lock_t *lock) { - lock->ticket = _ATOMIC_LOCK_UNLOCKED; + *lock = _ATOMIC_LOCK_UNLOCKED; } static void @@ -187,9 +185,9 @@ _rthread_init(void) tib->tib_thread = thread; thread->tib = tib; - thread->donesem.lock = _SPINLOCK_UNLOCKED_ASSIGN; + thread->donesem.lock = _SPINLOCK_UNLOCKED; tib->tib_thread_flags = TIB_THREAD_INITIAL_STACK; - thread->flags_lock = _SPINLOCK_UNLOCKED_ASSIGN; + thread->flags_lock = _SPINLOCK_UNLOCKED; strlcpy(thread->name, "Main process", sizeof(thread->name)); LIST_INSERT_HEAD(&_thread_list, thread, threads); _rthread_debug_init(); @@ -432,8 +430,8 @@ pthread_create(pthread_t *threadp, const pthread_attr_t *attr, thread = tib->tib_thread; memset(thread, 0, sizeof(*thread)); thread->tib = tib; - thread->donesem.lock = _SPINLOCK_UNLOCKED_ASSIGN; - thread->flags_lock = _SPINLOCK_UNLOCKED_ASSIGN; + thread->donesem.lock = _SPINLOCK_UNLOCKED; + thread->flags_lock = _SPINLOCK_UNLOCKED; thread->fn = start_routine; thread->arg = arg; tib->tib_tid = -1; @@ -643,7 +641,7 @@ _thread_dump_info(void) void _rthread_dl_lock(int what) { - static struct _spinlock lock = _SPINLOCK_UNLOCKED; + static _atomic_lock_t lock = _SPINLOCK_UNLOCKED; static pthread_t owner = NULL; static struct pthread_queue lockers = TAILQ_HEAD_INITIALIZER(lockers); static int count = 0; @@ -658,7 +656,7 @@ _rthread_dl_lock(int what) } else if (owner != self) { TAILQ_INSERT_TAIL(&lockers, self, waiting); while (owner != self) { - __thrsleep(self, 0, NULL, &lock.ticket, NULL); + __thrsleep(self, 0, NULL, &lock, NULL); _spinlock(&lock); } } @@ -679,7 +677,7 @@ _rthread_dl_lock(int what) } } else { /* reinit: used in child after fork to clear the queue */ - lock = _SPINLOCK_UNLOCKED_ASSIGN; + lock = _SPINLOCK_UNLOCKED; if (--count == 0) owner = NULL; TAILQ_INIT(&lockers); diff --git a/lib/librthread/rthread.h b/lib/librthread/rthread.h index df719f681e7..65217653f24 100644 --- a/lib/librthread/rthread.h +++ b/lib/librthread/rthread.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread.h,v 1.59 2016/09/03 16:44:20 akfaew Exp $ */ +/* $OpenBSD: rthread.h,v 1.60 2016/09/04 10:13:35 akfaew Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org> * All Rights Reserved. @@ -20,7 +20,7 @@ * Since only the thread library cares about their size or arrangement, * it should be possible to switch libraries without relinking. * - * Do not reorder struct _spinlock and sem_t variables in the structs. + * Do not reorder _atomic_lock_t and sem_t variables in the structs. * This is due to alignment requirements of certain arches like hppa. * The current requirement is 16 bytes. * @@ -37,17 +37,7 @@ #define RTHREAD_STACK_SIZE_DEF (256 * 1024) #endif -/* - * tickets don't work yet? (or seem much slower, with lots of system time) - * until then, keep the struct around to avoid excessive changes going - * back and forth. - */ -struct _spinlock { - _atomic_lock_t ticket; -}; - -#define _SPINLOCK_UNLOCKED { _ATOMIC_LOCK_UNLOCKED } -extern struct _spinlock _SPINLOCK_UNLOCKED_ASSIGN; +#define _SPINLOCK_UNLOCKED _ATOMIC_LOCK_UNLOCKED struct stack { SLIST_ENTRY(stack) link; /* link for free default stacks */ @@ -59,7 +49,7 @@ struct stack { }; struct __sem { - struct _spinlock lock; + _atomic_lock_t lock; volatile int waitcount; volatile int value; int shared; @@ -68,7 +58,7 @@ struct __sem { TAILQ_HEAD(pthread_queue, pthread); struct pthread_mutex { - struct _spinlock lock; + _atomic_lock_t lock; struct pthread_queue lockers; int type; pthread_t owner; @@ -83,7 +73,7 @@ struct pthread_mutex_attr { }; struct pthread_cond { - struct _spinlock lock; + _atomic_lock_t lock; struct pthread_queue waiters; struct pthread_mutex *mutex; clockid_t clock; @@ -94,7 +84,7 @@ struct pthread_cond_attr { }; struct pthread_rwlock { - struct _spinlock lock; + _atomic_lock_t lock; pthread_t owner; struct pthread_queue writers; int readers; @@ -149,7 +139,7 @@ struct pthread_barrierattr { }; struct pthread_spinlock { - struct _spinlock lock; + _atomic_lock_t lock; pthread_t owner; }; @@ -157,7 +147,7 @@ struct tib; struct pthread { struct __sem donesem; unsigned int flags; - struct _spinlock flags_lock; + _atomic_lock_t flags_lock; struct tib *tib; void *retval; void *(*fn)(void *); @@ -191,9 +181,9 @@ struct pthread { (((size) + (_thread_pagesize - 1)) & ~(_thread_pagesize - 1)) __BEGIN_HIDDEN_DECLS -void _spinlock(volatile struct _spinlock *); -int _spinlocktry(volatile struct _spinlock *); -void _spinunlock(volatile struct _spinlock *); +void _spinlock(volatile _atomic_lock_t *); +int _spinlocktry(volatile _atomic_lock_t *); +void _spinunlock(volatile _atomic_lock_t *); int _sem_wait(sem_t, int, const struct timespec *, int *); int _sem_post(sem_t); @@ -212,7 +202,7 @@ void _thread_malloc_reinit(void); extern int _threads_ready; extern size_t _thread_pagesize; extern LIST_HEAD(listhead, pthread) _thread_list; -extern struct _spinlock _thread_lock; +extern _atomic_lock_t _thread_lock; extern struct pthread_attr _rthread_attr_default; __END_HIDDEN_DECLS diff --git a/lib/librthread/rthread_file.c b/lib/librthread/rthread_file.c index 25d67ce659d..100ceaff545 100644 --- a/lib/librthread/rthread_file.c +++ b/lib/librthread/rthread_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_file.c,v 1.9 2016/09/03 16:44:20 akfaew Exp $ */ +/* $OpenBSD: rthread_file.c,v 1.10 2016/09/04 10:13:35 akfaew Exp $ */ /* * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>. * All rights reserved. @@ -87,7 +87,7 @@ static struct static_file_lock { } flh[NUM_HEADS]; /* Lock for accesses to the hash table: */ -static struct _spinlock hash_lock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t hash_lock = _SPINLOCK_UNLOCKED; /* * Find a lock structure for a FILE, return NULL if the file is @@ -205,7 +205,7 @@ _thread_flockfile(FILE * fp) */ TAILQ_INSERT_TAIL(&p->lockers,self,waiting); while (p->owner != self) { - __thrsleep(self, 0, NULL, &hash_lock.ticket, NULL); + __thrsleep(self, 0, NULL, &hash_lock, NULL); _spinlock(&hash_lock); } } @@ -301,4 +301,3 @@ _thread_funlockfile(FILE * fp) /* Unlock the hash table: */ _spinunlock(&hash_lock); } - diff --git a/lib/librthread/rthread_fork.c b/lib/librthread/rthread_fork.c index cc9f3d1d2fe..59d61b53e83 100644 --- a/lib/librthread/rthread_fork.c +++ b/lib/librthread/rthread_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_fork.c,v 1.18 2016/09/01 10:41:02 otto Exp $ */ +/* $OpenBSD: rthread_fork.c,v 1.19 2016/09/04 10:13:35 akfaew Exp $ */ /* * Copyright (c) 2008 Kurt Miller <kurt@openbsd.org> @@ -100,13 +100,13 @@ _dofork(pid_t (*sys_fork)(void)) #endif /* update this thread's structure */ tib->tib_tid = getthrid(); - me->donesem.lock = _SPINLOCK_UNLOCKED_ASSIGN; - me->flags_lock = _SPINLOCK_UNLOCKED_ASSIGN; + me->donesem.lock = _SPINLOCK_UNLOCKED; + me->flags_lock = _SPINLOCK_UNLOCKED; /* reinit the thread list */ LIST_INIT(&_thread_list); LIST_INSERT_HEAD(&_thread_list, me, threads); - _thread_lock = _SPINLOCK_UNLOCKED_ASSIGN; + _thread_lock = _SPINLOCK_UNLOCKED; /* single threaded now */ __isthreaded = 0; diff --git a/lib/librthread/rthread_libc.c b/lib/librthread/rthread_libc.c index c101fe29791..4209b244a7b 100644 --- a/lib/librthread/rthread_libc.c +++ b/lib/librthread/rthread_libc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_libc.c,v 1.16 2016/09/01 10:56:46 deraadt Exp $ */ +/* $OpenBSD: rthread_libc.c,v 1.17 2016/09/04 10:13:35 akfaew Exp $ */ /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ @@ -191,7 +191,7 @@ _thread_malloc_reinit(void) int i; for (i = 0; i < _MALLOC_MUTEXES; i++) { - malloc_lock[i].lock = _SPINLOCK_UNLOCKED_ASSIGN; + malloc_lock[i].lock = _SPINLOCK_UNLOCKED; TAILQ_INIT(&malloc_lock[i].lockers); malloc_lock[i].owner = NULL; malloc_lock[i].count = 0; @@ -201,7 +201,7 @@ _thread_malloc_reinit(void) /* * atexit lock */ -static struct _spinlock atexit_lock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t atexit_lock = _SPINLOCK_UNLOCKED; void _thread_atexit_lock(void) @@ -218,7 +218,7 @@ _thread_atexit_unlock(void) /* * atfork lock */ -static struct _spinlock atfork_lock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t atfork_lock = _SPINLOCK_UNLOCKED; void _thread_atfork_lock(void) @@ -235,7 +235,7 @@ _thread_atfork_unlock(void) /* * arc4random lock */ -static struct _spinlock arc4_lock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t arc4_lock = _SPINLOCK_UNLOCKED; void _thread_arc4_lock(void) @@ -248,4 +248,3 @@ _thread_arc4_unlock(void) { _spinunlock(&arc4_lock); } - diff --git a/lib/librthread/rthread_rwlock.c b/lib/librthread/rthread_rwlock.c index cb424b19a6d..4faeb92372a 100644 --- a/lib/librthread/rthread_rwlock.c +++ b/lib/librthread/rthread_rwlock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_rwlock.c,v 1.7 2016/09/03 16:44:20 akfaew Exp $ */ +/* $OpenBSD: rthread_rwlock.c,v 1.8 2016/09/04 10:13:35 akfaew Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org> * Copyright (c) 2012 Philip Guenther <guenther@openbsd.org> @@ -20,7 +20,6 @@ * rwlocks */ - #include <assert.h> #include <stdlib.h> #include <unistd.h> @@ -30,8 +29,7 @@ #include "rthread.h" - -static struct _spinlock rwlock_init_lock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t rwlock_init_lock = _SPINLOCK_UNLOCKED; int pthread_rwlock_init(pthread_rwlock_t *lockp, @@ -42,7 +40,7 @@ pthread_rwlock_init(pthread_rwlock_t *lockp, lock = calloc(1, sizeof(*lock)); if (!lock) return (errno); - lock->lock = _SPINLOCK_UNLOCKED_ASSIGN; + lock->lock = _SPINLOCK_UNLOCKED; TAILQ_INIT(&lock->writers); *lockp = lock; @@ -118,7 +116,7 @@ _rthread_rwlock_rdlock(pthread_rwlock_t *lockp, const struct timespec *abstime, else { do { if (__thrsleep(lock, CLOCK_REALTIME, abstime, - &lock->lock.ticket, NULL) == EWOULDBLOCK) + &lock->lock, NULL) == EWOULDBLOCK) return (ETIMEDOUT); _spinlock(&lock->lock); } while (lock->owner != NULL || !TAILQ_EMPTY(&lock->writers)); @@ -181,7 +179,7 @@ _rthread_rwlock_wrlock(pthread_rwlock_t *lockp, const struct timespec *abstime, TAILQ_INSERT_TAIL(&lock->writers, thread, waiting); do { do_wait = __thrsleep(thread, CLOCK_REALTIME, abstime, - &lock->lock.ticket, NULL) != EWOULDBLOCK; + &lock->lock, NULL) != EWOULDBLOCK; _spinlock(&lock->lock); } while (lock->owner != thread && do_wait); diff --git a/lib/librthread/rthread_sem.c b/lib/librthread/rthread_sem.c index 60c661c34d8..5d0e34294e7 100644 --- a/lib/librthread/rthread_sem.c +++ b/lib/librthread/rthread_sem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_sem.c,v 1.24 2016/09/03 16:44:20 akfaew Exp $ */ +/* $OpenBSD: rthread_sem.c,v 1.25 2016/09/04 10:13:35 akfaew Exp $ */ /* * Copyright (c) 2004,2005,2013 Ted Unangst <tedu@openbsd.org> * All Rights Reserved. @@ -72,7 +72,7 @@ _sem_wait(sem_t sem, int tryonly, const struct timespec *abstime, sem->waitcount++; do { r = __thrsleep(ident, CLOCK_REALTIME, abstime, - &sem->lock.ticket, delayed_cancel); + &sem->lock, delayed_cancel); _spinlock(&sem->lock); /* ignore interruptions other than cancelation */ if (r == EINTR && (delayed_cancel == NULL || @@ -160,7 +160,7 @@ sem_init(sem_t *semp, int pshared, unsigned int value) errno = ENOSPC; return (-1); } - sem->lock = _SPINLOCK_UNLOCKED_ASSIGN; + sem->lock = _SPINLOCK_UNLOCKED; sem->value = value; *semp = sem; @@ -395,7 +395,7 @@ sem_open(const char *name, int oflag, ...) return (SEM_FAILED); } if (created) { - sem->lock = _SPINLOCK_UNLOCKED_ASSIGN; + sem->lock = _SPINLOCK_UNLOCKED; sem->value = value; sem->shared = 1; } diff --git a/lib/librthread/rthread_spin_lock.c b/lib/librthread/rthread_spin_lock.c index 0957486b11b..9a18c096d3c 100644 --- a/lib/librthread/rthread_spin_lock.c +++ b/lib/librthread/rthread_spin_lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_spin_lock.c,v 1.3 2013/06/01 20:47:40 tedu Exp $ */ +/* $OpenBSD: rthread_spin_lock.c,v 1.4 2016/09/04 10:13:35 akfaew Exp $ */ /* * Copyright (c) 2012 Paul Irofti <pirofti@openbsd.org> * @@ -37,7 +37,7 @@ pthread_spin_init(pthread_spinlock_t *lock, int pshared) if (l == NULL) return (ENOMEM); - l->lock = _SPINLOCK_UNLOCKED_ASSIGN; + l->lock = _SPINLOCK_UNLOCKED; *lock = l; return (0); } diff --git a/lib/librthread/rthread_stack.c b/lib/librthread/rthread_stack.c index fadf1fbedae..6d3ab3a9b7b 100644 --- a/lib/librthread/rthread_stack.c +++ b/lib/librthread/rthread_stack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_stack.c,v 1.15 2016/09/01 10:56:46 deraadt Exp $ */ +/* $OpenBSD: rthread_stack.c,v 1.16 2016/09/04 10:13:35 akfaew Exp $ */ /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ @@ -18,7 +18,7 @@ * attributes for possible reuse. */ static SLIST_HEAD(, stack) def_stacks = SLIST_HEAD_INITIALIZER(head); -static struct _spinlock def_stacks_lock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t def_stacks_lock = _SPINLOCK_UNLOCKED; struct stack * _rthread_alloc_stack(pthread_t thread) @@ -134,4 +134,3 @@ _rthread_free_stack(struct stack *stack) free(stack); } } - diff --git a/lib/librthread/rthread_sync.c b/lib/librthread/rthread_sync.c index 7abf0709d1f..a9b490d5410 100644 --- a/lib/librthread/rthread_sync.c +++ b/lib/librthread/rthread_sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_sync.c,v 1.43 2016/09/03 16:44:20 akfaew Exp $ */ +/* $OpenBSD: rthread_sync.c,v 1.44 2016/09/04 10:13:35 akfaew Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org> * Copyright (c) 2012 Philip Guenther <guenther@openbsd.org> @@ -20,7 +20,6 @@ * Mutexes and conditions - synchronization functions. */ - #include <assert.h> #include <stdlib.h> #include <string.h> @@ -32,7 +31,7 @@ #include "rthread.h" #include "cancel.h" /* in libc/include */ -static struct _spinlock static_init_lock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t static_init_lock = _SPINLOCK_UNLOCKED; /* * mutexen @@ -45,7 +44,7 @@ pthread_mutex_init(pthread_mutex_t *mutexp, const pthread_mutexattr_t *attr) mutex = calloc(1, sizeof(*mutex)); if (!mutex) return (errno); - mutex->lock = _SPINLOCK_UNLOCKED_ASSIGN; + mutex->lock = _SPINLOCK_UNLOCKED; TAILQ_INIT(&mutex->lockers); if (attr == NULL) { mutex->type = PTHREAD_MUTEX_DEFAULT; @@ -131,7 +130,7 @@ _rthread_mutex_lock(pthread_mutex_t *mutexp, int trywait, /* self-deadlock, possibly until timeout */ while (__thrsleep(self, CLOCK_REALTIME, abstime, - &mutex->lock.ticket, NULL) != EWOULDBLOCK) + &mutex->lock, NULL) != EWOULDBLOCK) _spinlock(&mutex->lock); return (ETIMEDOUT); } @@ -148,7 +147,7 @@ _rthread_mutex_lock(pthread_mutex_t *mutexp, int trywait, TAILQ_INSERT_TAIL(&mutex->lockers, self, waiting); while (mutex->owner != self) { ret = __thrsleep(self, CLOCK_REALTIME, abstime, - &mutex->lock.ticket, NULL); + &mutex->lock, NULL); _spinlock(&mutex->lock); assert(mutex->owner != NULL); if (ret == EWOULDBLOCK) { @@ -250,7 +249,7 @@ pthread_cond_init(pthread_cond_t *condp, const pthread_condattr_t *attr) cond = calloc(1, sizeof(*cond)); if (!cond) return (errno); - cond->lock = _SPINLOCK_UNLOCKED_ASSIGN; + cond->lock = _SPINLOCK_UNLOCKED; TAILQ_INIT(&cond->waiters); if (attr == NULL) cond->clock = CLOCK_REALTIME; @@ -360,7 +359,7 @@ pthread_cond_timedwait(pthread_cond_t *condp, pthread_mutex_t *mutexp, /* wait until we're the owner of the mutex again */ while (mutex->owner != self) { error = __thrsleep(self, cond->clock, abstime, - &mutex->lock.ticket, &self->delayed_cancel); + &mutex->lock, &self->delayed_cancel); /* * If abstime == NULL, then we're definitely waiting @@ -509,7 +508,7 @@ pthread_cond_wait(pthread_cond_t *condp, pthread_mutex_t *mutexp) /* wait until we're the owner of the mutex again */ while (mutex->owner != self) { - error = __thrsleep(self, 0, NULL, &mutex->lock.ticket, + error = __thrsleep(self, 0, NULL, &mutex->lock, &self->delayed_cancel); /* diff --git a/lib/librthread/rthread_tls.c b/lib/librthread/rthread_tls.c index 80a75f8f088..7118132dfd2 100644 --- a/lib/librthread/rthread_tls.c +++ b/lib/librthread/rthread_tls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_tls.c,v 1.17 2016/04/02 19:56:53 guenther Exp $ */ +/* $OpenBSD: rthread_tls.c,v 1.18 2016/09/04 10:13:35 akfaew Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org> * All Rights Reserved. @@ -27,7 +27,7 @@ #include "rthread.h" static struct rthread_key rkeys[PTHREAD_KEYS_MAX]; -static struct _spinlock rkeyslock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t rkeyslock = _SPINLOCK_UNLOCKED; int pthread_key_create(pthread_key_t *key, void (*destructor)(void*)) |