Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
|
Go to the source code of this file.
Data Structures | |
union | pthread_mutexattr_t |
union | pthread_mutex_t |
union | pthread_attr_t |
union | pthread_cond_t |
union | pthread_once_t |
Macros | |
#define | PTHREAD_ONCE_INIT |
#define | PTHREAD_CREATE_DETACHED 0 |
#define | PTHREAD_CREATE_JOINABLE 1 |
#define | PTHREAD_PRIO_NONE 0 |
#define | PTHREAD_PRIO_INHERIT 1 |
#define | __SIZEOF_PTHREAD_MUTEXATTR_T 4 /* sizeof(struct mutex_attr) */ |
#define | __SIZEOF_PTHREAD_MUTEX_T 16 /* sizeof(struct mutex) */ |
#define | __SIZEOF_PTHREAD_ATTR_T 20 /* sizeof(struct thread_attr) */ |
#define | __SIZEOF_PTHREAD_COND_T 8 /* sizeof(struct cond) */ |
#define | __SIZEOF_PTHREAD_ONCE_T 12 /* sizeof(struct thread_once) */ |
Typedefs | |
typedef uint32_t | pthread_t |
typedef uint32_t | pthread_condattr_t |
Functions | |
int | pthread_attr_init (pthread_attr_t *attr) |
Initialize a thread attribute object with default values. More... | |
int | pthread_attr_destroy (pthread_attr_t *attr) |
Destroy the given thread attribute object. More... | |
int | pthread_attr_setschedparam (pthread_attr_t *attr, const struct sched_param *param) |
Set scheduling parameter of a thread attriute object. More... | |
int | pthread_attr_getschedparam (const pthread_attr_t *attr, struct sched_param *param) |
Get scheduling parameter of a thread attriute object. More... | |
int | pthread_attr_setschedpolicy (pthread_attr_t *attr, int policy) |
Set scheduling policy of a thread attriute object. More... | |
int | pthread_attr_getschedpolicy (const pthread_attr_t *attr, int *policy) |
Get scheduling parameter of a thread attriute object. More... | |
int | pthread_mutexattr_setprotocol (pthread_mutexattr_t *attr, int protocol) |
Set priority inheritance protocol of a mutex attriute object. More... | |
int | pthread_mutexattr_getprotocol (const pthread_mutexattr_t *attr, int *protocol) |
Get priority inheritance protocol of a mutex attriute object. More... | |
int | pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) |
Set stack size parameter of a thread attriute object. More... | |
int | pthread_attr_getstacksize (const pthread_attr_t *attr, size_t *stacksize) |
Get stack size parameter of a thread attriute object. More... | |
int | pthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate) |
Set detach state parameter of a thread attriute object. More... | |
int | pthread_attr_getdetachstate (const pthread_attr_t *attr, int *detachstate) |
Get detach state parameter of a thread attriute object. More... | |
int | pthread_attr_setstackaddr (pthread_attr_t *attr, void *stackaddr) |
Set stack address parameter of a thread attriute object. More... | |
int | pthread_attr_getstackaddr (const pthread_attr_t *attr, void **stackaddr) |
Get stack address parameter of a thread attriute object. More... | |
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. More... | |
pthread_t | pthread_self (void) |
Return the thread ID of the calling thread. More... | |
int | pthread_join (pthread_t thread, void **retval) |
Wait for a thread specified with the thread ID to terminate. More... | |
int | pthread_detach (pthread_t thread) |
Mark the thread identified by thread as detached. When a detached thread terminates, its resources are automatically released back to the system without the need for another thread to join with the terminated thread. More... | |
int | pthread_cancel (pthread_t thread) |
Send a cancellation request to a thread specified with the thread ID. More... | |
int | pthread_equal (pthread_t t1, pthread_t t2) |
Compare thread IDs. More... | |
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. More... | |
int | pthread_getschedparam (pthread_t thread, int *policy, struct sched_param *param) |
Get the scheduling parameters of a thread specified with the thread ID. More... | |
int | pthread_yield (void) |
To cause the calling thread to relinquish the CPU. More... | |
int | pthread_kill (pthread_t thread, int sig) |
Send a signal to a thread specified with the thread ID. More... | |
void | pthread_exit (void *retval) |
Terminate the calling thread and returns a value via retval. More... | |
int | pthread_mutexattr_init (pthread_mutexattr_t *attr) |
Initialize the mutex attribute object with default values. More... | |
int | pthread_mutexattr_destroy (pthread_mutexattr_t *attr) |
Destroy the mutex attribute object. More... | |
int | pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) |
Initialize the mutex with specified attributes. More... | |
int | pthread_mutex_destroy (pthread_mutex_t *mutex) |
Destroy the mutex. More... | |
int | pthread_mutex_unlock (pthread_mutex_t *mutex) |
Unlock the mutex. More... | |
int | pthread_mutex_lock (pthread_mutex_t *mutex) |
Lock the mutex. More... | |
int | pthread_mutex_trylock (pthread_mutex_t *mutex) |
Lock the mutex. If the mutex object referenced by mutex is currently locked (by any thread, including the current thread), the call shall return immediately. More... | |
int | pthread_condattr_init (pthread_condattr_t *attr) |
Initialize the attribute object of conditional variable with default values. More... | |
int | pthread_condattr_destroy (pthread_condattr_t *attr) |
Destroy the attribute object of the conditional variable. More... | |
int | pthread_cond_init (pthread_cond_t *cond, pthread_condattr_t cond_attr) |
Initializes the conditional variable with specified attributes. More... | |
int | pthread_cond_destroy (pthread_cond_t *cond) |
Destroy the conditional variable. More... | |
int | pthread_cond_signal (pthread_cond_t *cond) |
Restart one of the threads that are waiting on the condition variable. More... | |
int | pthread_cond_broadcast (pthread_cond_t *cond) |
Restart all of the threads that are waiting on the condition variable. More... | |
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. More... | |
int | pthread_once (pthread_once_t *once_control, void(*init_routine)(void)) |
To ensure a piece of initialization code is executed at most once. More... | |
#define PTHREAD_ONCE_INIT |
int pthread_attr_destroy | ( | pthread_attr_t * | attr | ) |
Destroy the given thread attribute object.
attr | The thread attribute object to destroy. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_getdetachstate | ( | const pthread_attr_t * | attr, |
int * | detachstate | ||
) |
Get detach state parameter of a thread attriute object.
attr | The attribute object to retrieve detach state. |
detachstate | For returning the detach state from the attribute object. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_getschedparam | ( | const pthread_attr_t * | attr, |
struct sched_param * | param | ||
) |
Get scheduling parameter of a thread attriute object.
attr | The attribute object to retrieve the scheduling parameter. |
param | For returning the scheduling parameter. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_getschedpolicy | ( | const pthread_attr_t * | attr, |
int * | policy | ||
) |
Get scheduling parameter of a thread attriute object.
attr | The attribute object to retrieve the scheduling policy. |
param | For returning the scheduling policy. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_getstackaddr | ( | const pthread_attr_t * | attr, |
void ** | stackaddr | ||
) |
Get stack address parameter of a thread attriute object.
attr | The attribute object to retrieve stack address. |
detachstate | For returning the stack address from the attribute object. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_getstacksize | ( | const pthread_attr_t * | attr, |
size_t * | stacksize | ||
) |
Get stack size parameter of a thread attriute object.
attr | The attribute object to retrieve stack size. |
stacksize | For returning the stack size from the attribute object. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_init | ( | pthread_attr_t * | attr | ) |
Initialize a thread attribute object with default values.
attr | The attribute object to initialize. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_setdetachstate | ( | pthread_attr_t * | attr, |
int | detachstate | ||
) |
Set detach state parameter of a thread attriute object.
attr | The attribute object to set detach state. |
detachstate | The detach state for setting the attribute object. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_setschedparam | ( | pthread_attr_t * | attr, |
const struct sched_param * | param | ||
) |
Set scheduling parameter of a thread attriute object.
attr | The attribute object to set. |
param | The scheduling parameter for setting the attribute object. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_setschedpolicy | ( | pthread_attr_t * | attr, |
int | policy | ||
) |
Set scheduling policy of a thread attriute object.
attr | The attribute object to set. |
param | The scheduling policy for setting the attribute object. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_setstackaddr | ( | pthread_attr_t * | attr, |
void * | stackaddr | ||
) |
Set stack address parameter of a thread attriute object.
attr | The attribute object to set stack address. |
detachstate | The stack address for setting the attribute object. |
int | 0 on success and nonzero error number on error. |
int pthread_attr_setstacksize | ( | pthread_attr_t * | attr, |
size_t | stacksize | ||
) |
Set stack size parameter of a thread attriute object.
attr | The attribute object to set. |
param | The stack size for setting the attribute object. |
int | 0 on success and nonzero error number on error. |
int pthread_cancel | ( | pthread_t | thread | ) |
Send a cancellation request to a thread specified with the thread ID.
thread | The thread ID to provide. |
int | 0 on success and nonzero error number on error. |
int pthread_cond_broadcast | ( | pthread_cond_t * | cond | ) |
Restart all of the threads that are waiting on the condition variable.
cond | The conditional variable to signal the state change. |
int | 0 on success and nonzero error number on error. |
int pthread_cond_destroy | ( | pthread_cond_t * | cond | ) |
Destroy the conditional variable.
cond | The conditional variable to destroy. |
int | 0 on success and nonzero error number on error. |
int pthread_cond_init | ( | pthread_cond_t * | cond, |
pthread_condattr_t | cond_attr | ||
) |
Initializes the conditional variable with specified attributes.
cond | The conditional variable object to initialize. |
cond_attr | The attribute object for initializing the conditional variable. |
int | 0 on success and nonzero error number on error. |
int pthread_cond_signal | ( | pthread_cond_t * | cond | ) |
Restart one of the threads that are waiting on the condition variable.
cond | The conditional variable object to signal the state change. |
int | 0 on success and nonzero error number on error. |
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.
cond | The conditional variable object for waiting the state change. |
int | 0 on success and nonzero error number on error. |
int pthread_condattr_destroy | ( | pthread_condattr_t * | attr | ) |
Destroy the attribute object of the conditional variable.
attr | The attribute object of conditional variable to destroy. |
int | 0 on success and nonzero error number on error. |
int pthread_condattr_init | ( | pthread_condattr_t * | attr | ) |
Initialize the attribute object of conditional variable with default values.
attr | The attribute object of the conditional variable to initialize. |
int | 0 on success and nonzero error number on error. |
int pthread_create | ( | pthread_t * | thread, |
const pthread_attr_t * | attr, | ||
void *(*)(void *) | start_routine, | ||
void * | arg | ||
) |
Start a new thread in the calling task.
thread | The thread ID of the new thread to return. |
attr | The attribute object for configuring the new thread. |
start_routine | The function to be called after the thread is launched. |
arg | The sole argument of the start_routine to be provided. |
int | 0 on success and nonzero error number on error. |
int pthread_detach | ( | pthread_t | thread | ) |
Mark the thread identified by thread as detached. When a detached thread terminates, its resources are automatically released back to the system without the need for another thread to join with the terminated thread.
thread | The thread ID to be provided. |
int | 0 on success and nonzero error number on error. |
int pthread_equal | ( | pthread_t | t1, |
pthread_t | t2 | ||
) |
Compare thread IDs.
t1 | The first thread ID to be provided. |
t2 | The second thread ID to be provided. |
int | If the two thread IDs are equal, the function returns a nonzero value; otherwise, it returns 0. |
void pthread_exit | ( | void * | retval | ) |
Terminate the calling thread and returns a value via retval.
retval | The return value pointer to provide. |
None |
int pthread_getschedparam | ( | pthread_t | thread, |
int * | policy, | ||
struct sched_param * | param | ||
) |
Get the scheduling parameters of a thread specified with the thread ID.
thread | The thread ID to provide. |
policy | Not used. |
param | For returning the scheduling parameter from the thread. |
int | 0 on success and nonzero error number on error. |
int pthread_join | ( | pthread_t | thread, |
void ** | retval | ||
) |
Wait for a thread specified with the thread ID to terminate.
thread | The thread ID to be provided. |
retval | The pointer to the return value pointer to provide. |
int | 0 on success and nonzero error number on error. |
int pthread_kill | ( | pthread_t | thread, |
int | sig | ||
) |
Send a signal to a thread specified with the thread ID.
thread | The thread ID to provide. |
sig | The signal number to provide. |
int | 0 on success and nonzero error number on error. |
int pthread_mutex_destroy | ( | pthread_mutex_t * | mutex | ) |
Destroy the mutex.
mutex | The mutex to destroy. |
int | 0 on success and nonzero error number on error. |
int pthread_mutex_init | ( | pthread_mutex_t * | mutex, |
const pthread_mutexattr_t * | attr | ||
) |
Initialize the mutex with specified attributes.
mutex | The mutex object to initialize. |
attr | The attribute object for initializing the mutex. |
int | 0 on success and nonzero error number on error. |
int pthread_mutex_lock | ( | pthread_mutex_t * | mutex | ) |
Lock the mutex.
mutex | The mutex to lock. |
int | 0 on success and nonzero error number on error. |
int pthread_mutex_trylock | ( | pthread_mutex_t * | mutex | ) |
Lock the mutex. If the mutex object referenced by mutex is currently locked (by any thread, including the current thread), the call shall return immediately.
mutex | The mutex to lock. |
int | 0 on success and nonzero error number on error. |
int pthread_mutex_unlock | ( | pthread_mutex_t * | mutex | ) |
Unlock the mutex.
mutex | The mutex to unlock. |
int | 0 on success and nonzero error number on error. |
int pthread_mutexattr_destroy | ( | pthread_mutexattr_t * | attr | ) |
Destroy the mutex attribute object.
attr | The mutex attribute object to destroy. |
int | 0 on success and nonzero error number on error. |
int pthread_mutexattr_getprotocol | ( | const pthread_mutexattr_t * | attr, |
int * | protocol | ||
) |
Get priority inheritance protocol of a mutex attriute object.
attr | The attribute object to retrieve the priority inheritance protocol. |
param | For returning the priority inheritance protocol. |
int | 0 on success and nonzero error number on error. |
int pthread_mutexattr_init | ( | pthread_mutexattr_t * | attr | ) |
Initialize the mutex attribute object with default values.
attr | The mutex attribute object to initialize. |
int | 0 on success and nonzero error number on error. |
int pthread_mutexattr_setprotocol | ( | pthread_mutexattr_t * | attr, |
int | protocol | ||
) |
Set priority inheritance protocol of a mutex attriute object.
attr | The attribute object to set. |
param | The protocol to set the attribute object. |
int | 0 on success and nonzero error number on error. |
int pthread_once | ( | pthread_once_t * | once_control, |
void(*)(void) | init_routine | ||
) |
To ensure a piece of initialization code is executed at most once.
once_control | The object to track the execution state of the init_routine. |
init_routine | The function to be called for once. |
int | 0 on success and nonzero error number on error. |
pthread_t pthread_self | ( | void | ) |
Return the thread ID of the calling thread.
None |
pthread_t | The thread ID. |
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.
thread | Thread ID to provide. |
policy | Not used. |
param | The scheduling parameter to set the thread. |
int | 0 on success and nonzero error number on error. |
int pthread_yield | ( | void | ) |
To cause the calling thread to relinquish the CPU.
None |
int | 0 on success and nonzero error number on error. |