From fc532ad891419709f379630d76b706a3bd124de3 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 29 Apr 2014 18:29:30 +0200 Subject: [PATCH] added else branch in `pthread_exit()` to avoid calling explicit `return;` however, this won't help to completely eliminate the warning on returning from a `noreturn` function --- sys/posix/pthread/pthread.c | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/sys/posix/pthread/pthread.c b/sys/posix/pthread/pthread.c index 2d48c9fcc0..99193b3bfa 100644 --- a/sys/posix/pthread/pthread.c +++ b/sys/posix/pthread/pthread.c @@ -169,37 +169,37 @@ void pthread_exit(void *retval) if (self_id == 0) { DEBUG("ERROR called pthread_self() returned 0 in \"%s\"!\n", __func__); - sched_task_exit(); - return; } + else { + pthread_thread_t *self = pthread_sched_threads[self_id-1]; - pthread_thread_t *self = pthread_sched_threads[self_id-1]; + while (self->cleanup_top) { + __pthread_cleanup_datum_t *ct = self->cleanup_top; + self->cleanup_top = ct->__next; - while (self->cleanup_top) { - __pthread_cleanup_datum_t *ct = self->cleanup_top; - self->cleanup_top = ct->__next; + ct->__routine(ct->__arg); + } - ct->__routine(ct->__arg); - } + self->thread_pid = -1; + DEBUG("pthread_exit(%p), self == %p\n", retval, (void *) self); + if (self->status != PTS_DETACHED) { + self->returnval = retval; + self->status = PTS_ZOMBIE; - self->thread_pid = -1; - DEBUG("pthread_exit(%p), self == %p\n", retval, (void *) self); - if (self->status != PTS_DETACHED) { - self->returnval = retval; - self->status = PTS_ZOMBIE; + if (self->joining_thread) { + /* our thread got an other thread waiting for us */ + thread_wakeup(self->joining_thread); + } + } - if (self->joining_thread) { - /* our thread got an other thread waiting for us */ - thread_wakeup(self->joining_thread); + dINT(); + if (self->stack) { + msg_t m; + m.content.ptr = self->stack; + msg_send_int(&m, pthread_reaper_pid); } } - dINT(); - if (self->stack) { - msg_t m; - m.content.ptr = self->stack; - msg_send_int(&m, pthread_reaper_pid); - } sched_task_exit(); }