Threading for Posix systems.
More...
Threading for Posix systems.
◆ LockStatus
Status codes for lock and synchronization operations.
| Enumerator |
|---|
| SUCCESS | Operation completed successfully.
|
| TIMEOUT | Operation timed out.
|
| ERROR | Operation failed with an error.
|
◆ ThreadStatus
Status codes for thread operations.
| Enumerator |
|---|
| SUCCESS | Operation completed successfully.
|
| ERROR | Operation failed with an error.
|
| UNSUPPORTED | Operation is not supported on this platform.
|
◆ condvar_destroy()
| LockStatus fsb::condvar_destroy |
( |
pthread_cond_t & |
cond_var | ) |
|
Destroy a condition variable and release its resources.
- Parameters
-
| cond_var | Reference to the condition variable to destroy |
- Returns
- LockStatus indicating success or failure
◆ condvar_initialize()
| LockStatus fsb::condvar_initialize |
( |
pthread_cond_t & |
cond_var, |
|
|
bool |
shared = false |
|
) |
| |
Initialize a condition variable.
- Parameters
-
| cond_var | Reference to the condition variable to initialize |
| shared | If true, condition variable can be shared across processes; if false, only within threads |
- Returns
- LockStatus indicating success or failure
◆ condvar_signal()
| LockStatus fsb::condvar_signal |
( |
pthread_cond_t & |
cond_var, |
|
|
bool |
broadcast = false |
|
) |
| |
Signal one or all threads waiting on a condition variable.
- Parameters
-
| cond_var | Reference to the condition variable to signal |
| broadcast | If true, wake all waiting threads; if false, wake only one thread |
- Returns
- LockStatus indicating success or failure
◆ condvar_wait_timeout()
| LockStatus fsb::condvar_wait_timeout |
( |
pthread_cond_t & |
cond_var, |
|
|
pthread_mutex_t & |
mutex, |
|
|
const struct timespec & |
timeout |
|
) |
| |
Wait on a condition variable with a timeout.
- Parameters
-
| cond_var | Reference to the condition variable to wait on |
| mutex | Reference to the mutex associated with the condition variable |
| timeout | Absolute time at which to timeout |
- Returns
- LockStatus indicating success, timeout, or failure
◆ mutex_destroy()
| LockStatus fsb::mutex_destroy |
( |
pthread_mutex_t & |
mutex | ) |
|
Destroy a mutex and release its resources.
- Parameters
-
| mutex | Reference to the mutex to destroy |
- Returns
- LockStatus indicating success or failure
◆ mutex_initialize()
| LockStatus fsb::mutex_initialize |
( |
pthread_mutex_t & |
mutex, |
|
|
bool |
shared = false |
|
) |
| |
Initialize a mutex.
- Parameters
-
| mutex | Reference to the mutex to initialize |
| shared | If true, mutex can be shared across processes; if false, only within threads |
- Returns
- LockStatus indicating success or failure
◆ mutex_lock()
| LockStatus fsb::mutex_lock |
( |
pthread_mutex_t & |
mutex | ) |
|
Lock a mutex, blocking until the lock is acquired.
- Parameters
-
| mutex | Reference to the mutex to lock |
- Returns
- LockStatus indicating success or failure
◆ mutex_unlock()
| LockStatus fsb::mutex_unlock |
( |
pthread_mutex_t & |
mutex | ) |
|
Unlock a mutex.
- Parameters
-
| mutex | Reference to the mutex to unlock |
- Returns
- LockStatus indicating success or failure
◆ set_thread_cpu_affinity()
| ThreadStatus fsb::set_thread_cpu_affinity |
( |
pthread_t |
thread, |
|
|
size_t |
cpu_index |
|
) |
| |
Set the CPU affinity of a thread to a specific CPU core.
- Parameters
-
| thread | The pthread handle of the thread to modify |
| cpu_index | The index of the CPU core to bind the thread to |
- Returns
- ThreadStatus indicating success or failure
◆ set_thread_priority()
| ThreadStatus fsb::set_thread_priority |
( |
pthread_t |
thread, |
|
|
int |
policy, |
|
|
int |
priority |
|
) |
| |
Set the scheduling priority of a thread.
- Parameters
-
| thread | The pthread handle of the thread to modify |
| policy | The scheduling policy (e.g., SCHED_FIFO, SCHED_RR, SCHED_OTHER) |
| priority | The priority value within the policy's range |
- Returns
- ThreadStatus indicating success or failure