18 #pragma GCC system_header 19 #include_next <pthread.h> 21 #ifndef _COBALT_PTHREAD_H 22 #define _COBALT_PTHREAD_H 24 #include <boilerplate/libc.h> 25 #include <cobalt/wrappers.h> 26 #include <cobalt/uapi/thread.h> 28 typedef struct pthread_attr_ex {
33 struct sched_param_ex sched_param;
41 COBALT_DECL(
int, pthread_attr_init(pthread_attr_t *attr));
44 const pthread_attr_t *attr,
45 void *(*start) (
void *),
50 struct sched_param *param));
54 const struct sched_param *param));
56 COBALT_DECL(
int, pthread_setschedprio(pthread_t thread,
int prio));
59 const pthread_mutexattr_t *attr));
66 const struct timespec *to));
74 int *__restrict old_ceiling));
77 int *__restrict old_ceiling));
80 const pthread_condattr_t *attr));
85 pthread_mutex_t *mutex));
88 pthread_mutex_t *mutex,
89 const struct timespec *abstime));
97 COBALT_DECL(
int,
pthread_join(pthread_t ptid,
void **retval));
115 int pthread_create_ex(pthread_t *ptid_r,
116 const pthread_attr_ex_t *attr_ex,
117 void *(*start)(
void *),
122 struct sched_param_ex *par);
126 const struct sched_param_ex *par);
128 int pthread_attr_init_ex(pthread_attr_ex_t *attr_ex);
130 int pthread_attr_destroy_ex(pthread_attr_ex_t *attr_ex);
132 int pthread_attr_setschedpolicy_ex(pthread_attr_ex_t *attr_ex,
135 int pthread_attr_getschedpolicy_ex(
const pthread_attr_ex_t *attr_ex,
138 int pthread_attr_setschedparam_ex(pthread_attr_ex_t *attr_ex,
139 const struct sched_param_ex *param_ex);
141 int pthread_attr_getschedparam_ex(
const pthread_attr_ex_t *attr_ex,
142 struct sched_param_ex *param_ex);
144 int pthread_attr_getinheritsched_ex(
const pthread_attr_ex_t *attr_ex,
147 int pthread_attr_setinheritsched_ex(pthread_attr_ex_t *attr_ex,
150 int pthread_attr_getdetachstate_ex(
const pthread_attr_ex_t *attr_ex,
153 int pthread_attr_setdetachstate_ex(pthread_attr_ex_t *attr_ex,
156 int pthread_attr_setdetachstate_ex(pthread_attr_ex_t *attr_ex,
159 int pthread_attr_getstacksize_ex(
const pthread_attr_ex_t *attr_ex,
162 int pthread_attr_setstacksize_ex(pthread_attr_ex_t *attr_ex,
165 int pthread_attr_getscope_ex(
const pthread_attr_ex_t *attr_ex,
168 int pthread_attr_setscope_ex(pthread_attr_ex_t *attr_ex,
171 int pthread_attr_getpersonality_ex(
const pthread_attr_ex_t *attr_ex,
174 int pthread_attr_setpersonality_ex(pthread_attr_ex_t *attr_ex,
int pthread_getschedparam(pthread_t thread, int *__restrict__ policy, struct sched_param *__restrict__ param)
Get the scheduling policy and parameters of the specified thread.
Definition: thread.c:738
int pthread_mutex_lock(pthread_mutex_t *mutex)
Lock a mutex.
Definition: mutex.c:320
int pthread_cond_signal(pthread_cond_t *cond)
Signal a condition variable.
Definition: cond.c:445
int pthread_mutex_trylock(pthread_mutex_t *mutex)
Attempt to lock a mutex.
Definition: mutex.c:531
int pthread_mutex_getprioceiling(pthread_mutex_t *__restrict mutex, int *__restrict old_ceiling)
Get a mutex's priority ceiling.
Definition: mutex.c:772
int pthread_setschedparam_ex(pthread_t ptid, int pol, const struct sched_param_ex *par)
Set extended scheduling policy of thread
Definition: thread.c:612
int pthread_setmode_np(int clrmask, int setmask, int *mask_r)
Set the mode of the current thread.
Definition: thread.c:383
int pthread_cond_broadcast(pthread_cond_t *cond)
Broadcast a condition variable.
Definition: cond.c:501
int pthread_mutex_unlock(pthread_mutex_t *mutex)
Unlock a mutex.
Definition: mutex.c:628
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
Wait on a condition variable.
Definition: cond.c:280
int pthread_getschedparam_ex(pthread_t thread, int *__restrict__ policy_r, struct sched_param_ex *__restrict__ param_ex)
Get extended scheduling policy of thread
Definition: thread.c:779
int pthread_cond_destroy(pthread_cond_t *cond)
Destroy a condition variable
Definition: cond.c:201
int pthread_setname_np(pthread_t thread, const char *name)
Set a thread name.
Definition: thread.c:408
int pthread_kill(pthread_t ptid, int sig)
Send a signal to a thread.
Definition: thread.c:437
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
Wait a bounded time on a condition variable.
Definition: cond.c:371
int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)
Set the scheduling policy and parameters of the specified thread.
Definition: thread.c:548
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
Initialize a condition variable
Definition: cond.c:120
int pthread_yield(void)
Yield the processor.
Definition: thread.c:811
int pthread_mutex_destroy(pthread_mutex_t *mutex)
Destroy a mutex.
Definition: mutex.c:272
int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *to)
Attempt, during a bounded time, to lock a mutex.
Definition: mutex.c:431
int pthread_create(pthread_t *ptid_r, const pthread_attr_t *attr, void *(*start)(void *), void *arg)
Create a new thread
Definition: thread.c:277
int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict mutex, int prioceiling, int *__restrict old_ceiling)
Set a mutex's priority ceiling.
Definition: mutex.c:720
int pthread_join(pthread_t ptid, void **retval)
Wait for termination of a specified thread.
Definition: thread.c:486
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Initialize a mutex.
Definition: mutex.c:118