diff options
Diffstat (limited to 'src/thread')
-rw-r--r-- | src/thread/pthread_cancel.c | 3 | ||||
-rw-r--r-- | src/thread/pthread_create.c | 2 | ||||
-rw-r--r-- | src/thread/pthread_key_create.c | 10 | ||||
-rw-r--r-- | src/thread/pthread_setcancelstate.c | 1 |
4 files changed, 5 insertions, 11 deletions
diff --git a/src/thread/pthread_cancel.c b/src/thread/pthread_cancel.c index a507f923..7c5dda31 100644 --- a/src/thread/pthread_cancel.c +++ b/src/thread/pthread_cancel.c @@ -30,7 +30,7 @@ long __syscall_cp_c(syscall_arg_t nr, long r; int st; - if (!libc.has_thread_pointer || (st=(self=__pthread_self())->canceldisable) + if ((st=(self=__pthread_self())->canceldisable) && (st==PTHREAD_CANCEL_DISABLE || nr==SYS_close)) return __syscall(nr, u, v, w, x, y, z); @@ -69,7 +69,6 @@ static void cancel_handler(int sig, siginfo_t *si, void *ctx) void __testcancel() { - if (!libc.has_thread_pointer) return; pthread_t self = __pthread_self(); if (self->cancel && !self->canceldisable) __cancel(); diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index 33808ce5..6963f0d6 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -122,7 +122,6 @@ _Noreturn void __pthread_exit(void *result) void __do_cleanup_push(struct __ptcb *cb) { - if (!libc.has_thread_pointer) return; struct pthread *self = __pthread_self(); cb->__next = self->cancelbuf; self->cancelbuf = cb; @@ -130,7 +129,6 @@ void __do_cleanup_push(struct __ptcb *cb) void __do_cleanup_pop(struct __ptcb *cb) { - if (!libc.has_thread_pointer) return; __pthread_self()->cancelbuf = cb->__next; } diff --git a/src/thread/pthread_key_create.c b/src/thread/pthread_key_create.c index 198ae56e..a78e507a 100644 --- a/src/thread/pthread_key_create.c +++ b/src/thread/pthread_key_create.c @@ -13,13 +13,11 @@ int __pthread_key_create(pthread_key_t *k, void (*dtor)(void *)) { unsigned i = (uintptr_t)&k / 16 % PTHREAD_KEYS_MAX; unsigned j = i; + pthread_t self = __pthread_self(); - if (libc.has_thread_pointer) { - pthread_t self = __pthread_self(); - /* This can only happen in the main thread before - * pthread_create has been called. */ - if (!self->tsd) self->tsd = __pthread_tsd_main; - } + /* This can only happen in the main thread before + * pthread_create has been called. */ + if (!self->tsd) self->tsd = __pthread_tsd_main; if (!dtor) dtor = nodtor; do { diff --git a/src/thread/pthread_setcancelstate.c b/src/thread/pthread_setcancelstate.c index 822a1398..5ab8c338 100644 --- a/src/thread/pthread_setcancelstate.c +++ b/src/thread/pthread_setcancelstate.c @@ -3,7 +3,6 @@ int __pthread_setcancelstate(int new, int *old) { if (new > 2U) return EINVAL; - if (!libc.has_thread_pointer) return ENOSYS; struct pthread *self = __pthread_self(); if (old) *old = self->canceldisable; self->canceldisable = new; |