|
CAEN Utility
2.0.2
Utilities for CAEN projects
|
Platform independent functions to manage threads. More...
Modules | |
| Tickets related functions | |
| Platform independent implementation of fair mutex. | |
Functions | |
| c_thread_t | c_thread_invalid () |
| int32_t | c_thread_create (c_thread_t *thr, c_tstart_t func, void *arg) |
| int32_t | c_thread_join (c_thread_t thr, int *res) |
| int32_t | c_thread_timedjoin (c_thread_t thr, int *res, int32_t timeout_ms) |
| int32_t | c_thread_setaffinity (c_thread_t thr, uint64_t mask) |
| c_thread_t | c_thread_current (void) |
| void | c_thread_yield (void) |
| int32_t | c_thread_detach (c_thread_t thr) |
| void | c_thread_exit (int res) |
| bool | c_thread_equal (c_thread_t lhs, c_thread_t rhs) |
| int32_t | c_thread_sleep (const struct timespec *duration, struct timespec *remaining) |
| int32_t | c_sleep (uint32_t ms) |
Platform independent functions to manage threads.
| c_thread_t c_thread_invalid | ( | ) |
Initializer for invalid c_thread_t
Definition at line 609 of file CAENThread.c.
| int32_t c_thread_create | ( | c_thread_t * | thr, |
| c_tstart_t | func, | ||
| void * | arg | ||
| ) |
Create thread
| [out] | thr | a pointer to uninitialized c_thread_t |
| [in] | func | function to execute |
| [out] | arg | argument to pass to the function |
Definition at line 621 of file CAENThread.c.
| int32_t c_thread_join | ( | c_thread_t | thr, |
| int * | res | ||
| ) |
Join thread
| [in] | thr | a pointer to initialized c_thread_t |
| [out] | res | location to put the result code to |
Definition at line 654 of file CAENThread.c.
| int32_t c_thread_timedjoin | ( | c_thread_t | thr, |
| int * | res, | ||
| int32_t | timeout_ms | ||
| ) |
Join thread with timeout
| [in] | thr | a pointer to initialized c_thread_t |
| [out] | res | location to put the result code to |
| [in] | timeout_ms | timeout in milliseconds |
Definition at line 658 of file CAENThread.c.
| int32_t c_thread_setaffinity | ( | c_thread_t | thr, |
| uint64_t | mask | ||
| ) |
Set affinity to a specific set of CPU core
| [in] | thr | a pointer to initialized c_thread_t |
| [in] | mask | a mask with bit set to 1 at the position of the required cores |
Definition at line 68 of file CAENThread.c.
| c_thread_t c_thread_current | ( | void | ) |
Get the identifier of the calling thread.
Definition at line 100 of file CAENThread.c.
| void c_thread_yield | ( | void | ) |
Provides a hint to the implementation to reschedule the execution of threads, allowing other threads to run
Definition at line 112 of file CAENThread.c.
| int32_t c_thread_detach | ( | c_thread_t | thr | ) |
Detach a thread
| [in] | thr | a pointer to initialized c_thread_t |
Definition at line 127 of file CAENThread.c.
| void c_thread_exit | ( | int | res | ) |
Terminate the execution of the calling thread and set its result code to res.
| [in] | res | result code |
Definition at line 147 of file CAENThread.c.
| bool c_thread_equal | ( | c_thread_t | lhs, |
| c_thread_t | rhs | ||
| ) |
Checks whether lhs and rhs refer to the same thread.
| [in] | lhs | thread to compare |
| [in] | rhs | thread to compare |
Definition at line 155 of file CAENThread.c.
| int32_t c_thread_sleep | ( | const struct timespec * | duration, |
| struct timespec * | remaining | ||
| ) |
Blocks the execution of the current thread for a period of time
| [in] | duration | pointer to the duration to sleep for |
| [out] | remaining | pointer to the object to put the remaining time on interruption; may be NULL, in which case it is ignored |
Definition at line 537 of file CAENThread.c.
| int32_t c_sleep | ( | uint32_t | ms | ) |
Blocks the execution of the current thread for a period of time
| [in] | ms | period in ms |
Definition at line 566 of file CAENThread.c.