1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:17:35 +00:00

Kernel+LibPthread: pthread_create handles pthread_attr_t

Add an initial implementation of pthread attributes for:
  * detach state (joinable, detached)
  * schedule params (just priority)
  * guard page size (as skeleton) (requires kernel support maybe?)
  * stack size and user-provided stack location (4 or 8 MB only, must be aligned)

Add some tests too, to the thread test program.

Also, LibC: Move pthread declarations to sys/types.h, where they belong.
This commit is contained in:
Andrew Kaster 2019-11-17 20:08:10 -07:00 committed by Andreas Kling
parent aae26a3a1e
commit 618aebdd8a
9 changed files with 596 additions and 23 deletions

View file

@ -33,3 +33,5 @@
#define MB_LEN_MAX 16
#define ARG_MAX 65536
#define PTHREAD_STACK_MIN 65536

View file

@ -1,7 +1,7 @@
#pragma once
#include <stddef.h>
#include <bits/stdint.h>
#include <stddef.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
@ -60,4 +60,16 @@ struct utimbuf {
time_t modtime;
};
typedef int pthread_t;
typedef void* pthread_key_t;
typedef void* pthread_once_t;
typedef uint32_t pthread_mutex_t;
typedef void* pthread_attr_t;
typedef void* pthread_mutexattr_t;
typedef void* pthread_cond_t;
typedef void* pthread_rwlock_t;
typedef void* pthread_rwlockatrr_t;
typedef void* pthread_spinlock_t;
typedef void* pthread_condattr_t;
__END_DECLS