summaryrefslogtreecommitdiff
path: root/Libraries/LibPthread
diff options
context:
space:
mode:
authorMuhammad Zahalqa <m@tryfinally.com>2020-07-18 22:35:12 +0300
committerAndreas Kling <kling@serenityos.org>2020-07-21 01:10:41 +0200
commitf2d3cc7325c6c75b7ceff55c030c22ac89e3ce4d (patch)
treefc644e3b31aa0eb34a4b5eb19f4db3ba0bf09967 /Libraries/LibPthread
parent19d6884529db681bc917f7f3d0a5cee496a76a0e (diff)
downloadserenity-f2d3cc7325c6c75b7ceff55c030c22ac89e3ce4d.zip
LibPThread: Make pthread_exit a noreturn function
LibPThread: mark pthread_exit a noreturn function using compiler attributes LibThread: remove a call to pthread_exit from Thread::start lambda expression as it make the return of teh lambda unreachable.
Diffstat (limited to 'Libraries/LibPthread')
-rw-r--r--Libraries/LibPthread/pthread.cpp1
-rw-r--r--Libraries/LibPthread/pthread.h2
2 files changed, 2 insertions, 1 deletions
diff --git a/Libraries/LibPthread/pthread.cpp b/Libraries/LibPthread/pthread.cpp
index e90e8a7399..f3a17849b6 100644
--- a/Libraries/LibPthread/pthread.cpp
+++ b/Libraries/LibPthread/pthread.cpp
@@ -83,6 +83,7 @@ static int create_thread(void* (*entry)(void*), void* argument, PthreadAttrImpl*
return syscall(SC_create_thread, pthread_create_helper, thread_params);
}
+[[noreturn]]
static void exit_thread(void* code)
{
syscall(SC_exit_thread, code);
diff --git a/Libraries/LibPthread/pthread.h b/Libraries/LibPthread/pthread.h
index 6fbb7453bb..1f71b911b8 100644
--- a/Libraries/LibPthread/pthread.h
+++ b/Libraries/LibPthread/pthread.h
@@ -35,7 +35,7 @@
__BEGIN_DECLS
int pthread_create(pthread_t*, pthread_attr_t*, void* (*)(void*), void*);
-void pthread_exit(void*);
+void pthread_exit(void*) __attribute__ ((noreturn));
int pthread_kill(pthread_t, int);
void pthread_cleanup_push(void (*)(void*), void*);
void pthread_cleanup_pop(int);