1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:27:42 +00:00

LibPthread: implicitly call pthread_exit on return from start routine.

Previously, when returning from a pthread's start_routine, we would
segfault. Now we instead implicitly call pthread_exit as specified in
the standard.

pthread_create now creates a thread running the new
pthread_create_helper, which properly manages the calling and exiting
of the start_routine supplied to pthread_create. To accomplish this,
the thread's stack initialization has been moved out of
sys$create_thread and into the userspace function create_thread.
This commit is contained in:
Drew Stratford 2020-04-25 22:20:44 +12:00 committed by Andreas Kling
parent 4cb765e520
commit 4a37362249
3 changed files with 32 additions and 8 deletions

View file

@ -272,7 +272,7 @@ public:
int sys$getpeername(const Syscall::SC_getpeername_params*);
int sys$sched_setparam(pid_t pid, const struct sched_param* param);
int sys$sched_getparam(pid_t pid, struct sched_param* param);
int sys$create_thread(void* (*)(void*), void* argument, const Syscall::SC_create_thread_params*);
int sys$create_thread(void* (*)(void*), const Syscall::SC_create_thread_params*);
void sys$exit_thread(void*);
int sys$join_thread(int tid, void** exit_value);
int sys$detach_thread(int tid);