mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +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:
@@ -2807,7 +2807,7 @@ int Process::thread_count() const
|
||||
return count;
|
||||
}
|
||||
|
||||
int Process::sys$create_thread(int (*entry)(void*), void* argument)
|
||||
int Process::sys$create_thread(void* (*entry)(void*), void* argument)
|
||||
{
|
||||
if (!validate_read((const void*)entry, sizeof(void*)))
|
||||
return -EFAULT;
|
||||
@@ -2822,11 +2822,13 @@ int Process::sys$create_thread(int (*entry)(void*), void* argument)
|
||||
return thread->tid();
|
||||
}
|
||||
|
||||
void Process::sys$exit_thread(int code)
|
||||
void Process::sys$exit_thread(void* code)
|
||||
{
|
||||
UNUSED_PARAM(code);
|
||||
cli();
|
||||
if (¤t->process().main_thread() == current) {
|
||||
sys$exit(code);
|
||||
// FIXME: For POSIXy reasons, we should only sys$exit once *all* threads have exited.
|
||||
sys$exit(0);
|
||||
return;
|
||||
}
|
||||
current->set_state(Thread::State::Dying);
|
||||
|
||||
Reference in New Issue
Block a user