![]() |
ROOT-Sim core
3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
|
Generic architecture management facilities. More...
#include <arch/platform.h>

Go to the source code of this file.
Typedefs | |
| typedef thrd_ret_t(THREAD_CALL_CONV * | thr_run_fnc) (void *) |
| The function type of a new thread entry point. | |
Functions | |
| int | thread_start (thr_id_t *thr_p, thr_run_fnc t_fnc, void *t_fnc_arg) |
| Creates a thread. More... | |
| int | thread_affinity_set (thr_id_t thr, unsigned core) |
| Sets a core affinity for a thread. More... | |
| int | thread_wait (thr_id_t thr, thrd_ret_t *ret) |
| Wait for specified thread to complete execution. More... | |
| unsigned | thread_cores_count (void) |
| Computes the count of available cores on the machine. More... | |
Generic architecture management facilities.
This module provides generic facilities for thread and core management. In particular, helper functions to startup worker threads are exposed, and a function to synchronize multiple threads on a software barrier.
The software barrier also offers a leader election facility, so that once all threads are synchronized on the barrier, the function returns true to only one of them.
| thread_affinity_set | ( | thr_id_t | thr, |
| unsigned | core | ||
| ) |
Sets a core affinity for a thread.
| thr | The identifier of the thread targeted for the affinity change |
| core | The core id where the target thread will be pinned on |
| thread_cores_count | ( | void | ) |
Computes the count of available cores on the machine.
| thread_start | ( | thr_id_t * | thr_p, |
| thr_run_fnc | t_fnc, | ||
| void * | t_fnc_arg | ||
| ) |
Creates a thread.
| thr_p | A pointer to the location where the created thread identifier will be copied |
| t_fnc | The new thread entry point |
| t_fnc_arg | A pointer to the argument to be passed to the new thread entry point |
| thread_wait | ( | thr_id_t | thr, |
| thrd_ret_t * | ret | ||
| ) |
Wait for specified thread to complete execution.
| thr | The identifier of the thread to wait for |
| ret | A pointer to the location where the return value will be copied, or alternatively NULL |