13 #define PTHREAD_ONCE_INIT \
15 .wq = {.next = NULL, .prev = NULL}, .finished = false \
18 #define PTHREAD_CREATE_DETACHED 0
19 #define PTHREAD_CREATE_JOINABLE 1
21 #define PTHREAD_PRIO_NONE 0
22 #define PTHREAD_PRIO_INHERIT 1
24 #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
25 #define __SIZEOF_PTHREAD_MUTEX_T 16
26 #define __SIZEOF_PTHREAD_ATTR_T 20
27 #define __SIZEOF_PTHREAD_COND_T 8
28 #define __SIZEOF_PTHREAD_ONCE_T 12
30 typedef uint32_t pthread_t;
31 typedef uint32_t pthread_condattr_t;
34 char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
39 char __size[__SIZEOF_PTHREAD_MUTEX_T];
44 char __size[__SIZEOF_PTHREAD_ATTR_T];
49 char __size[__SIZEOF_PTHREAD_COND_T];
54 char __size[__SIZEOF_PTHREAD_ONCE_T];
185 void *(*start_routine)(
void *),
int pthread_condattr_destroy(pthread_condattr_t *attr)
Destroy the attribute object of the conditional variable.
Definition: pthread.c:313
int pthread_attr_init(pthread_attr_t *attr)
Initialize a thread attribute object with default values.
Definition: pthread.c:12
int pthread_mutex_lock(pthread_mutex_t *mutex)
Lock the mutex.
Definition: pthread.c:293
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:214
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:355
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, int *protocol)
Get priority inheritance protocol of a mutex attriute object.
Definition: pthread.c:94
int pthread_cond_signal(pthread_cond_t *cond)
Restart one of the threads that are waiting on the condition variable.
Definition: pthread.c:340
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
Destroy the mutex attribute object.
Definition: pthread.c:239
void pthread_exit(void *retval)
Terminate the calling thread and returns a value via retval.
Definition: pthread.c:283
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:298
int pthread_join(pthread_t thread, void **retval)
Wait for a thread specified with the thread ID to terminate.
Definition: pthread.c:194
int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
Set stack address parameter of a thread attriute object.
Definition: pthread.c:156
int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t cond_attr)
Initializes the conditional variable with specified attributes.
Definition: pthread.c:322
int pthread_condattr_init(pthread_condattr_t *attr)
Initialize the attribute object of conditional variable with default values.
Definition: pthread.c:303
int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
Get detach state parameter of a thread attriute object.
Definition: pthread.c:145
int pthread_mutex_destroy(pthread_mutex_t *mutex)
Destroy the mutex.
Definition: pthread.c:264
int pthread_attr_destroy(pthread_attr_t *attr)
Destroy the given thread attribute object.
Definition: pthread.c:26
pthread_t pthread_self(void)
Return the thread ID of the calling thread.
Definition: pthread.c:189
int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param)
Set scheduling parameter of a thread attriute object.
Definition: pthread.c:37
int pthread_kill(pthread_t thread, int sig)
Send a signal to a thread specified with the thread ID.
Definition: pthread.c:278
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Initialize the mutex with specified attributes.
Definition: pthread.c:248
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
Set scheduling policy of a thread attriute object.
Definition: pthread.c:61
int pthread_detach(pthread_t thread)
Mark the thread identified by thread as detached. When a detached thread terminates,...
Definition: pthread.c:199
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
Set stack size parameter of a thread attriute object.
Definition: pthread.c:106
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:350
int pthread_mutex_unlock(pthread_mutex_t *mutex)
Unlock the mutex.
Definition: pthread.c:288
int pthread_equal(pthread_t t1, pthread_t t2)
Compare thread IDs.
Definition: pthread.c:209
int pthread_cancel(pthread_t thread)
Send a cancellation request to a thread specified with the thread ID.
Definition: pthread.c:204
int pthread_cond_destroy(pthread_cond_t *cond)
Destroy the conditional variable.
Definition: pthread.c:331
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:221
int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
Get stack address parameter of a thread attriute object.
Definition: pthread.c:170
int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
Get stack size parameter of a thread attriute object.
Definition: pthread.c:117
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:181
int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
Set detach state parameter of a thread attriute object.
Definition: pthread.c:128
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol)
Set priority inheritance protocol of a mutex attriute object.
Definition: pthread.c:83
int pthread_yield(void)
To cause the calling thread to relinquish the CPU.
Definition: pthread.c:273
int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
Get scheduling parameter of a thread attriute object.
Definition: pthread.c:72
int pthread_mutexattr_init(pthread_mutexattr_t *attr)
Initialize the mutex attribute object with default values.
Definition: pthread.c:228
int pthread_cond_broadcast(pthread_cond_t *cond)
Restart all of the threads that are waiting on the condition variable.
Definition: pthread.c:345
int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param)
Get scheduling parameter of a thread attriute object.
Definition: pthread.c:49