Threads. More...
Go to the source code of this file.
Macros | |
pthread detach state. | |
#define | PTHREAD_CREATE_DETACHED 0 |
#define | PTHREAD_CREATE_JOINABLE 1 |
Returned to a single thread after a successful pthread_barrier_wait. | |
POSIX specifies that "The constant PTHREAD_BARRIER_SERIAL_THREAD is defined in <pthread.h> and its value shall be distinct from any other value returned by pthread_barrier_wait()." So it's defined as negative to distinguish it from the errnos, which are positive. | |
#define | PTHREAD_BARRIER_SERIAL_THREAD ( -2 ) |
Mutex types. | |
#define | PTHREAD_MUTEX_NORMAL 0 |
#define | PTHREAD_MUTEX_ERRORCHECK 1 |
#define | PTHREAD_MUTEX_RECURSIVE 2 |
#define | PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL |
Compile-time initializers. | |
#define | PTHREAD_COND_INITIALIZER FREERTOS_POSIX_COND_INITIALIZER |
Functions | |
int | pthread_attr_destroy (pthread_attr_t *attr) |
Destroy the thread attributes object. More... | |
int | pthread_attr_getdetachstate (const pthread_attr_t *attr, int *detachstate) |
Get detachstate attribute. More... | |
int | pthread_attr_getschedparam (const pthread_attr_t *attr, struct sched_param *param) |
Get schedparam attribute. More... | |
int | pthread_attr_getstacksize (const pthread_attr_t *attr, size_t *stacksize) |
Get stacksize attribute. More... | |
int | pthread_attr_init (pthread_attr_t *attr) |
Initialize the thread attributes object. More... | |
int | pthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate) |
Set detachstate attribute. More... | |
int | pthread_attr_setschedparam (pthread_attr_t *attr, const struct sched_param *param) |
Set schedparam attribute. More... | |
int | pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) |
Set stacksize attribute. More... | |
int | pthread_barrier_destroy (pthread_barrier_t *barrier) |
Destroy a barrier object. More... | |
int | pthread_barrier_init (pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned count) |
Initialize a barrier object. More... | |
int | pthread_barrier_wait (pthread_barrier_t *barrier) |
Synchronize at a barrier. More... | |
int | pthread_create (pthread_t *thread, const pthread_attr_t *attr, void *(*startroutine)(void *), void *arg) |
Thread creation. More... | |
int | pthread_cond_broadcast (pthread_cond_t *cond) |
Broadcast a condition. More... | |
int | pthread_cond_destroy (pthread_cond_t *cond) |
Destroy condition variables. More... | |
int | pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *attr) |
Initialize condition variables. More... | |
int | pthread_cond_signal (pthread_cond_t *cond) |
Signal a condition. More... | |
int | pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime) |
Wait on a condition with a timeout. More... | |
int | pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) |
Wait on a condition. More... | |
int | pthread_equal (pthread_t t1, pthread_t t2) |
Compare thread IDs. More... | |
void | pthread_exit (void *value_ptr) |
Thread termination. More... | |
int | pthread_getschedparam (pthread_t thread, int *policy, struct sched_param *param) |
Dynamic thread scheduling parameters access. More... | |
int | pthread_join (pthread_t thread, void **retval) |
Wait for thread termination. More... | |
int | pthread_mutex_destroy (pthread_mutex_t *mutex) |
Destroy a mutex. More... | |
int | pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) |
Initialize a mutex. More... | |
int | pthread_mutex_lock (pthread_mutex_t *mutex) |
Lock a mutex. More... | |
int | pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *abstime) |
Lock a mutex with timeout. More... | |
int | pthread_mutex_trylock (pthread_mutex_t *mutex) |
Attempt to lock a mutex. Fail immediately if mutex is already locked. More... | |
int | pthread_mutex_unlock (pthread_mutex_t *mutex) |
Unlock a mutex. More... | |
int | pthread_mutexattr_destroy (pthread_mutexattr_t *attr) |
Destroy the mutex attributes object. More... | |
int | pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *type) |
Get the mutex type attribute. More... | |
int | pthread_mutexattr_init (pthread_mutexattr_t *attr) |
Initialize the mutex attributes object. More... | |
int | pthread_mutexattr_settype (pthread_mutexattr_t *attr, int type) |
Set the mutex type attribute. More... | |
pthread_t | pthread_self (void) |
Get the calling thread ID. More... | |
int | pthread_setschedparam (pthread_t thread, int policy, const struct sched_param *param) |
Dynamic thread scheduling parameters access. More... | |
#define PTHREAD_CREATE_DETACHED 0 |
Detached.
#define PTHREAD_CREATE_JOINABLE 1 |
Joinable (default).
#define PTHREAD_MUTEX_NORMAL 0 |
Non-robust, deadlock on relock, does not remember owner.
#define PTHREAD_MUTEX_ERRORCHECK 1 |
Non-robust, error on relock, remembers owner.
#define PTHREAD_MUTEX_RECURSIVE 2 |
Non-robust, recursive relock, remembers owner.
#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL |
PTHREAD_MUTEX_NORMAL (default).
#define PTHREAD_COND_INITIALIZER FREERTOS_POSIX_COND_INITIALIZER |
pthread_cond_t.
int pthread_attr_destroy | ( | pthread_attr_t * | attr | ) |
Destroy the thread attributes object.
0 | - Upon successful completion |
int pthread_attr_getdetachstate | ( | const pthread_attr_t * | attr, |
int * | detachstate | ||
) |
Get detachstate attribute.
0 | - Upon successful completion |
int pthread_attr_getschedparam | ( | const pthread_attr_t * | attr, |
struct sched_param * | param | ||
) |
Get schedparam attribute.
0 | - Upon successful completion |
int pthread_attr_getstacksize | ( | const pthread_attr_t * | attr, |
size_t * | stacksize | ||
) |
Get stacksize attribute.
0 | - Upon successful completion |
int pthread_attr_init | ( | pthread_attr_t * | attr | ) |
Initialize the thread attributes object.
0 | - Upon successful completion |
ENOMEM | - Insufficient memory exists to initialize the thread attributes object. |
int pthread_attr_setdetachstate | ( | pthread_attr_t * | attr, |
int | detachstate | ||
) |
Set detachstate attribute.
0 | - Upon successful completion |
EINVAL | - The value of detachstate is not valid. Currently, supported detach states are – PTHREAD_CREATE_DETACHED and PTHREAD_CREATE_JOINABLE. |
int pthread_attr_setschedparam | ( | pthread_attr_t * | attr, |
const struct sched_param * | param | ||
) |
Set schedparam attribute.
0 | - Upon successful completion |
EINVAL | - The value of param is not valid. |
ENOTSUP | - An attempt was made to set the attribute to an unsupported value. |
int pthread_attr_setstacksize | ( | pthread_attr_t * | attr, |
size_t | stacksize | ||
) |
Set stacksize attribute.
0 | - Upon successful completion |
EINVAL | - The value of stacksize is less than {PTHREAD_STACK_MIN} |
int pthread_barrier_destroy | ( | pthread_barrier_t * | barrier | ) |
Destroy a barrier object.
0 | - Upon successful completion |
int pthread_barrier_init | ( | pthread_barrier_t * | barrier, |
const pthread_barrierattr_t * | attr, | ||
unsigned | count | ||
) |
Initialize a barrier object.
0 | - Upon successful completion |
EINVAL | - The value specified by count is equal to zero. |
ENOMEM | - count cannot fit into FreeRTOS event group type OR insufficient memory exists to initialize the barrier. |
int pthread_barrier_wait | ( | pthread_barrier_t * | barrier | ) |
Synchronize at a barrier.
PTHREAD_BARRIER_SERIAL_THREAD | - Upon successful completion, the first thread. |
0 | - Upon successful completion, other thread(s). |
int pthread_create | ( | pthread_t * | thread, |
const pthread_attr_t * | attr, | ||
void *(*)(void *) | startroutine, | ||
void * | arg | ||
) |
Thread creation.
0 | - Upon successful completion |
EAGAIN | - Insufficient memory for either thread structure or task creation. |
int pthread_cond_broadcast | ( | pthread_cond_t * | cond | ) |
Broadcast a condition.
0 | - Upon successful completion |
int pthread_cond_destroy | ( | pthread_cond_t * | cond | ) |
Destroy condition variables.
0 | - Upon successful completion |
int pthread_cond_init | ( | pthread_cond_t * | cond, |
const pthread_condattr_t * | attr | ||
) |
Initialize condition variables.
0 | - Upon successful completion |
ENOMEM | - Insufficient memory exists to initialize the condition variable. |
int pthread_cond_signal | ( | pthread_cond_t * | cond | ) |
Signal a condition.
0 | - Upon successful completion |
int pthread_cond_timedwait | ( | pthread_cond_t * | cond, |
pthread_mutex_t * | mutex, | ||
const struct timespec * | abstime | ||
) |
Wait on a condition with a timeout.
0 | - Upon successful completion |
EINVAL | - The abstime argument passed in does not refer to an initialized structure OR the abstime parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million. |
ETIMEDOUT | - The time specified by abstime to pthread_cond_timedwait() has passed. |
int pthread_cond_wait | ( | pthread_cond_t * | cond, |
pthread_mutex_t * | mutex | ||
) |
Wait on a condition.
0 | - Upon successful completion |
Compare thread IDs.
0 | - t1 and t2 are both not NULL && equal |
non-zero | - otherwise |
void pthread_exit | ( | void * | value_ptr | ) |
Thread termination.
void | - this function cannot return to its caller. |
int pthread_getschedparam | ( | pthread_t | thread, |
int * | policy, | ||
struct sched_param * | param | ||
) |
Dynamic thread scheduling parameters access.
0 | - Upon successful completion |
int pthread_join | ( | pthread_t | thread, |
void ** | retval | ||
) |
Wait for thread termination.
0 | - Upon successful completion |
EDEADLK | - The value specified by the thread argument to pthread_join() does not refer to a joinable thread OR multiple simultaneous calls to pthread_join() specifying the same target thread OR the value specified by the thread argument to pthread_join() refers to the calling thread. |
int pthread_mutex_destroy | ( | pthread_mutex_t * | mutex | ) |
Destroy a mutex.
0 | - Upon successful completion |
int pthread_mutex_init | ( | pthread_mutex_t * | mutex, |
const pthread_mutexattr_t * | attr | ||
) |
Initialize a mutex.
0 | - Upon successful completion |
ENOMEM | - Insufficient memory exists to initialize the mutex structure. |
EAGAIN | - Unable to initialize the mutex structure member(s). |
int pthread_mutex_lock | ( | pthread_mutex_t * | mutex | ) |
Lock a mutex.
0 | - Upon successful completion |
EINVAL | - the abstime parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million. |
EDEADLK | - The mutex type is PTHREAD_MUTEX_ERRORCHECK and the current thread already owns the mutex. |
int pthread_mutex_timedlock | ( | pthread_mutex_t * | mutex, |
const struct timespec * | abstime | ||
) |
Lock a mutex with timeout.
0 | - Upon successful completion |
EINVAL | - The abstime argument passed in does not refer to an initialized structure OR the abstime parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million. |
EDEADLK | - The mutex type is PTHREAD_MUTEX_ERRORCHECK and the current thread already owns the mutex. |
ETIMEDOUT | - The mutex could not be locked before the specified timeout expired. |
int pthread_mutex_trylock | ( | pthread_mutex_t * | mutex | ) |
Attempt to lock a mutex. Fail immediately if mutex is already locked.
0 | - Upon successful completion |
EINVAL | - the abstime parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million. |
EDEADLK | - The mutex type is PTHREAD_MUTEX_ERRORCHECK and the current thread already owns the mutex. |
EBUSY | - The mutex could not be acquired because it was already locked. |
int pthread_mutex_unlock | ( | pthread_mutex_t * | mutex | ) |
Unlock a mutex.
0 | - Upon successful completion |
EPERM | - The mutex type is PTHREAD_MUTEX_ERRORCHECK or PTHREAD_MUTEX_RECURSIVE, and the current thread does not own the mutex. |
int pthread_mutexattr_destroy | ( | pthread_mutexattr_t * | attr | ) |
Destroy the mutex attributes object.
0 | - Upon successful completion |
int pthread_mutexattr_gettype | ( | const pthread_mutexattr_t * | attr, |
int * | type | ||
) |
Get the mutex type attribute.
0 | - Upon successful completion |
int pthread_mutexattr_init | ( | pthread_mutexattr_t * | attr | ) |
Initialize the mutex attributes object.
0 | - Upon successful completion |
ENOMEM | - Insufficient memory exists to initialize the mutex attributes object. |
int pthread_mutexattr_settype | ( | pthread_mutexattr_t * | attr, |
int | type | ||
) |
Set the mutex type attribute.
0 | - Upon successful completion |
EINVAL | - The value type is invalid. |
pthread_t pthread_self | ( | void | ) |
Get the calling thread ID.
the | thread ID of the calling thread. |
int pthread_setschedparam | ( | pthread_t | thread, |
int | policy, | ||
const struct sched_param * | param | ||
) |
Dynamic thread scheduling parameters access.
0 | - Upon successful completion |