Public library API.
More...
|
class | Ignore |
| Class for ignoring arguments when doing dependency analysis. More...
|
|
class | Observer |
| When destroyed, it makes sure that all the tasks spawned by the current thread since its creation have finished. More...
|
|
|
template<typename T > |
Ignore< T > | ignore (T &&t) |
| Traits for arguments or parameters that should be ignored.
|
|
void | set_task_queue_limit (int limit) noexcept |
|
int | get_task_queue_limit () noexcept |
|
void | set_threads (int nthreads=-1) |
|
int | get_num_threads () noexcept |
| Retrieve number of threads currently in use.
|
|
internal::TaskPool & | get_task_pool () |
|
template<typename Function , typename... Args> |
internal::spawn_ret_t | spawn (const Function &f, Args &&... args) |
|
template<typename T , typename... Args> |
std::enable_if< std::is_reference< T >::value &&!std::is_member_function_pointer< typenamestd::remove_reference< T >::type >::value &&!std::is_function< typenamestd::remove_reference< T >::type >::value &&!internal::is_function_object< typenamestd::remove_reference< T >::type >::value, internal::spawn_ret_t >::type | spawn (T &&functor, Args &&... args) |
| Spawns a functor, but only if there is a single operator()
|
|
void | wait_for_all () |
| Waits for all tasks to finish.
|
|
void | wait_for_subtasks (bool priority=true) |
|
template<typename... Args> |
void | wait_for (const Args &... args) |
| Wait for a specific group of variables to be written.
|
|
◆ get_task_pool()
internal::TaskPool & depspawn::get_task_pool |
( |
| ) |
|
Obtain non-TBB DepSpawn task pool. If not initialized, it builds it in running state When DEPSPAWN_USE_TBB is defined, the returned task pool has 0 threads and does not run
◆ get_task_queue_limit()
int depspawn::get_task_queue_limit |
( |
| ) |
|
|
noexcept |
Retrieve the value set by set_task_queue_limit() or the environment variable DEPSPAWN_TASK_QUEUE_LIMIT or -1 if DepSpawn was not compiled with DEPSPAWN_FAST_START on.
◆ set_task_queue_limit()
void depspawn::set_task_queue_limit |
( |
int |
limit | ) |
|
|
noexcept |
Define the maximum number of ready tasks allowed to be waiting to be executed before the enqueueing thread tries to execute one of them.
This value only makes sense if the library has been compiled with DEPSPAWN_FAST_START on. By default the library sets this value to twice the number of threads in use.
◆ set_threads()
void depspawn::set_threads |
( |
int |
nthreads = -1 | ) |
|
Specify the number of threads to use.
If the library has been compiled with DEPSPAWN_FAST_START and the task queue limit has not been set with set_task_queue_limit() or the environment varible DEPSPAWN_TASK_QUEUE_LIMIT, this function asks for two ready tasks per thread as default.
- Parameters
-
nthreads | Number of threads to use. The value -1 uses one thread per hardware thread available, which is the default behavior when the argument is not specified. |
◆ wait_for()
template<typename... Args>
void depspawn::wait_for |
( |
const Args &... |
args | ) |
|
Wait for a specific group of variables to be written.
Notice that since this function only waits for writes, there could be active tasks reading these variables when this function returns to the caller.
- Parameters
-
args | arguments to wait for |
◆ wait_for_subtasks()
void depspawn::wait_for_subtasks |
( |
bool |
priority = true | ) |
|
Waits for all the subtasks of the current task to finish
- Parameters
-
priority | if true, the thread will only execute subtasks it depends on during the wait. Otherwise, if it is idle because all those tasks are already running or waiting for dependencies, it can run other tasks while it waits. |