14 #define PTHREAD_ONCE_INIT \
16 .wq = {.next = NULL, .prev = NULL}, .finished = false \
19 #define PTHREAD_CREATE_DETACHED 0
20 #define PTHREAD_CREATE_JOINABLE 1
22 #define PTHREAD_PRIO_NONE 0
23 #define PTHREAD_PRIO_INHERIT 1
25 #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
26 #define __SIZEOF_PTHREAD_MUTEX_T 16
27 #define __SIZEOF_PTHREAD_ATTR_T 20
28 #define __SIZEOF_PTHREAD_COND_T 8
29 #define __SIZEOF_PTHREAD_ONCE_T 12
31 typedef uint32_t pthread_t;
32 typedef uint32_t pthread_condattr_t;
35 char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
40 char __size[__SIZEOF_PTHREAD_MUTEX_T];
45 char __size[__SIZEOF_PTHREAD_ATTR_T];
50 char __size[__SIZEOF_PTHREAD_COND_T];
55 char __size[__SIZEOF_PTHREAD_ONCE_T];
186 void *(*start_routine)(
void *),
int pthread_condattr_destroy(pthread_condattr_t *attr)
Destroy the attribute object of the conditional variable.
Definition: pthread.c:393
int pthread_attr_init(pthread_attr_t *attr)
Initialize a thread attribute object with default values.
Definition: pthread.c:13
int pthread_mutex_lock(pthread_mutex_t *mutex)
Lock the mutex.
Definition: pthread.c:357
int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)
Set the scheduling parameters of a thread specified with the thread ID.
Definition: pthread.c:251
int pthread_once(pthread_once_t *once_control, void(*init_routine)(void))
To ensure a piece of initialization code is executed at most once.
Definition: pthread.c:471
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, int *protocol)
Get priority inheritance protocol of a mutex attriute object.
Definition: pthread.c:95
int pthread_cond_signal(pthread_cond_t *cond)
Restart one of the threads that are waiting on the condition variable.
Definition: pthread.c:425
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
Destroy the mutex attribute object.
Definition: pthread.c:283
void pthread_exit(void *retval)
Terminate the calling thread and returns a value via retval.
Definition: pthread.c:337
int pthread_mutex_trylock(pthread_mutex_t *mutex)
Lock the mutex. If the mutex object referenced by mutex is currently locked (by any thread,...
Definition: pthread.c:367
int pthread_join(pthread_t thread, void **retval)
Wait for a thread specified with the thread ID to terminate.
Definition: pthread.c:214
int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
Set stack address parameter of a thread attriute object.
Definition: pthread.c:157
int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t cond_attr)
Initializes the conditional variable with specified attributes.
Definition: pthread.c:402
int pthread_condattr_init(pthread_condattr_t *attr)
Initialize the attribute object of conditional variable with default values.
Definition: pthread.c:383
int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
Get detach state parameter of a thread attriute object.
Definition: pthread.c:146
int pthread_mutex_destroy(pthread_mutex_t *mutex)
Destroy the mutex.
Definition: pthread.c:308
int pthread_attr_destroy(pthread_attr_t *attr)
Destroy the given thread attribute object.
Definition: pthread.c:27
pthread_t pthread_self(void)
Return the thread ID of the calling thread.
Definition: pthread.c:204
int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param)
Set scheduling parameter of a thread attriute object.
Definition: pthread.c:38
int pthread_kill(pthread_t thread, int sig)
Send a signal to a thread specified with the thread ID.
Definition: pthread.c:332
int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime)
Lock the mutex with absolute timeout.
Definition: pthread.c:378
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Initialize the mutex with specified attributes.
Definition: pthread.c:292
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
Set scheduling policy of a thread attriute object.
Definition: pthread.c:62
int pthread_detach(pthread_t thread)
Mark the thread identified by thread as detached. When a detached thread terminates,...
Definition: pthread.c:224
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
Set stack size parameter of a thread attriute object.
Definition: pthread.c:107
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
Atomically unlock the mutex and wait for the condition variable to be signaled.
Definition: pthread.c:446
int pthread_mutex_unlock(pthread_mutex_t *mutex)
Unlock the mutex.
Definition: pthread.c:347
int pthread_equal(pthread_t t1, pthread_t t2)
Compare thread IDs.
Definition: pthread.c:239
int pthread_cancel(pthread_t thread)
Send a cancellation request to a thread specified with the thread ID.
Definition: pthread.c:234
int pthread_cond_destroy(pthread_cond_t *cond)
Destroy the conditional variable.
Definition: pthread.c:411
int pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *param)
Get the scheduling parameters of a thread specified with the thread ID.
Definition: pthread.c:265
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
Wait on condition variable with absolute timeout.
Definition: pthread.c:458
int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
Get stack address parameter of a thread attriute object.
Definition: pthread.c:171
int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
Get stack size parameter of a thread attriute object.
Definition: pthread.c:118
int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Start a new thread in the calling task.
Definition: pthread.c:196
int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
Set detach state parameter of a thread attriute object.
Definition: pthread.c:129
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol)
Set priority inheritance protocol of a mutex attriute object.
Definition: pthread.c:84
int pthread_yield(void)
To cause the calling thread to relinquish the CPU.
Definition: pthread.c:322
int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
Get scheduling parameter of a thread attriute object.
Definition: pthread.c:73
int pthread_mutexattr_init(pthread_mutexattr_t *attr)
Initialize the mutex attribute object with default values.
Definition: pthread.c:272
int pthread_cond_broadcast(pthread_cond_t *cond)
Restart all of the threads that are waiting on the condition variable.
Definition: pthread.c:435
int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param)
Get scheduling parameter of a thread attriute object.
Definition: pthread.c:50