1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

LibPthread: Start working on a POSIX threading library

This patch adds pthread_create() and pthread_exit(), which currently
simply wrap our existing create_thread() and exit_thread() syscalls.

LibThread is also ported to using LibPthread.
This commit is contained in:
Andreas Kling 2019-11-13 21:49:24 +01:00
parent 4fe2ee0221
commit 69ca9cfd78
16 changed files with 89 additions and 31 deletions

View file

@ -1,5 +1,5 @@
#include <AK/String.h>
#include <AK/ScopedValueRollback.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <Kernel/Syscall.h>
#include <assert.h>
@ -540,13 +540,13 @@ char* getlogin()
return nullptr;
}
int create_thread(int (*entry)(void*), void* argument)
int create_thread(void *(*entry)(void*), void* argument)
{
int rc = syscall(SC_create_thread, entry, argument);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
void exit_thread(int code)
void exit_thread(void* code)
{
syscall(SC_exit_thread, code);
ASSERT_NOT_REACHED();
@ -633,5 +633,4 @@ int get_process_name(char* buffer, int buffer_size)
int rc = syscall(SC_get_process_name, buffer, buffer_size);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
}