Turi Create
4.0
|
This is a rather complete threading library, providing cross platform implementations of many threading primitives. More...
Classes | |
class | turi::deferred_rwlock |
class | turi::lockfree_push_back< Container, T > |
class | turi::mutex |
class | turi::recursive_mutex |
class | turi::simple_spinlock |
class | turi::padded_simple_spinlock |
class | turi::conditional |
class | turi::cancellable_barrier |
class | turi::thread |
class | turi::thread_group |
class | turi::queued_rw_lock |
Functions | |
template<typename T > | |
bool | turi::atomic_compare_and_swap (T &a, T oldval, T newval) |
template<typename T > | |
bool | turi::atomic_compare_and_swap (volatile T &a, T oldval, T newval) |
template<typename T > | |
T | turi::atomic_compare_and_swap_val (T &a, T oldval, T newval) |
template<typename T > | |
T | turi::atomic_compare_and_swap_val (volatile T &a, T oldval, T newval) |
template<> | |
bool | turi::atomic_compare_and_swap (volatile double &a, double oldval, double newval) |
template<> | |
bool | turi::atomic_compare_and_swap (volatile float &a, float oldval, float newval) |
template<typename T > | |
void | turi::atomic_exchange (T &a, T &b) |
Atomically exchanges the values of a and b. More... | |
template<typename T > | |
void | turi::atomic_exchange (volatile T &a, T &b) |
Atomically exchanges the values of a and b. More... | |
template<typename T > | |
T | turi::fetch_and_store (T &a, const T &newval) |
Atomically sets a to the newval, returning the old value. | |
std::exception_ptr | turi::execute_task_in_native_thread (const std::function< void(void)> &fn) |
void | turi::in_parallel (const std::function< void(size_t thread_id, size_t num_threads)> &fn) |
thread_pool & | turi::get_parfor_thread_pool () |
template<typename FunctionType > | |
void | turi::parallel_for (size_t begin, size_t end, const FunctionType &fn) |
template<typename FunctionType , typename ReduceType > | |
ReduceType | turi::fold_reduce (size_t begin, size_t end, const FunctionType &fn, ReduceType base=ReduceType()) |
template<typename RandomAccessIterator , typename FunctionType > | |
void | turi::parallel_for (RandomAccessIterator iter_begin, RandomAccessIterator iter_end, const FunctionType &fn, std::random_access_iterator_tag=typename std::iterator_traits< RandomAccessIterator >::iterator_category()) |
This is a rather complete threading library, providing cross platform implementations of many threading primitives.
bool turi::atomic_compare_and_swap | ( | T & | a, |
T | oldval, | ||
T | newval | ||
) |
atomic instruction that is equivalent to the following:
Definition at line 27 of file atomic_ops.hpp.
bool turi::atomic_compare_and_swap | ( | volatile T & | a, |
T | oldval, | ||
T | newval | ||
) |
atomic instruction that is equivalent to the following:
Definition at line 45 of file atomic_ops.hpp.
|
inline |
atomic instruction that is equivalent to the following:
Definition at line 103 of file atomic_ops.hpp.
|
inline |
atomic instruction that is equivalent to the following:
Definition at line 126 of file atomic_ops.hpp.
T turi::atomic_compare_and_swap_val | ( | T & | a, |
T | oldval, | ||
T | newval | ||
) |
atomic instruction that is equivalent to the following:
Definition at line 65 of file atomic_ops.hpp.
T turi::atomic_compare_and_swap_val | ( | volatile T & | a, |
T | oldval, | ||
T | newval | ||
) |
atomic instruction that is equivalent to the following:
Definition at line 83 of file atomic_ops.hpp.
void turi::atomic_exchange | ( | T & | a, |
T & | b | ||
) |
Atomically exchanges the values of a and b.
Definition at line 142 of file atomic_ops.hpp.
void turi::atomic_exchange | ( | volatile T & | a, |
T & | b | ||
) |
Atomically exchanges the values of a and b.
Definition at line 153 of file atomic_ops.hpp.
std::exception_ptr turi::execute_task_in_native_thread | ( | const std::function< void(void)> & | fn | ) |
Takes a function and executes it in a native stack space. Used to get by some libjvm oddities when using coroutines.
Returns an exception if an exception was thrown while executing the inner task.
ReduceType turi::fold_reduce | ( | size_t | begin, |
size_t | end, | ||
const FunctionType & | fn, | ||
ReduceType | base = ReduceType() |
||
) |
Runs a map reduce operation for ranging from the integers 'begin' to 'end'.
When run single threaded, is equivalent to
Example:
begin | The beginning integer of the for loop |
end | The ending integer of the for loop |
fn | The function to run. The function must take a single size_t argument which is a current index. |
Definition at line 158 of file lambda_omp.hpp.
thread_pool& turi::get_parfor_thread_pool | ( | ) |
Returns the thread pool dedicated for running parallel for jobs.
|
inline |
Runs a provided function in parallel, passing the function the thread ID and the number of threads. The thread ID is always between 0 and #threads - 1.
fn | The function to run. The function must take two size_t arguments: the thread ID and the number of threads. |
Definition at line 35 of file lambda_omp.hpp.
void turi::parallel_for | ( | size_t | begin, |
size_t | end, | ||
const FunctionType & | fn | ||
) |
Runs a parallel for ranging from the integers 'begin' to 'end'.
When run single threaded, is equivalent to
Example:
begin | The beginning integer of the for loop |
end | The ending integer of the for loop |
fn | The function to run. The function must take a single size_t argument which is a current index. |
Definition at line 93 of file lambda_omp.hpp.
|
inline |
Runs a parallel for over a random access iterator range.
When run single threaded, is equivalent to
Example:
begin | The beginning integer of the for loop |
end | The ending integer of the for loop |
fn | The function to run. The function must take a single size_t argument which is a current index. |
Definition at line 229 of file lambda_omp.hpp.