mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 09:37:34 +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:
parent
4fe2ee0221
commit
69ca9cfd78
16 changed files with 89 additions and 31 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue