A library for working with phylogenetic and population genetic data.
v0.32.0
thread_functions.hpp File Reference
#include "genesis/utils/core/options.hpp"
#include "genesis/utils/threading/multi_future.hpp"
#include "genesis/utils/threading/thread_pool.hpp"
#include <atomic>
#include <cassert>
#include <condition_variable>
#include <functional>
#include <future>
#include <memory>
#include <mutex>
#include <stdexcept>
#include <thread>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  ThreadCriticalSection< Tag >
 Helper class to define a critical section. More...
 

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::utils
 

Macros

#define GENESIS_THREAD_CRITICAL_SECTION(TagName)
 

Functions

template<typename F , typename T1 , typename T2 , typename T = typename std::common_type<T1, T2>::type, typename R = typename std::result_of<typename std::decay<F>::type(T, T)>::type>
MultiFuture< R > parallel_block (T1 begin, T2 end, F &&body, std::shared_ptr< ThreadPool > thread_pool=nullptr, size_t num_blocks=0, bool auto_wait=true)
 Parallel block over a range of elements, breaking the range into blocks for which the body function is executed individually. More...
 
template<typename F , typename T1 , typename T2 , typename T = typename std::common_type<T1, T2>::type>
MultiFuture< void > parallel_for (T1 begin, T2 end, F &&body, std::shared_ptr< ThreadPool > thread_pool=nullptr, size_t num_blocks=0, bool auto_wait=true)
 Parallel for over a range of positions, breaking the range into blocks for which the body function is executed individually. More...
 
template<typename F , typename T >
MultiFuture< void > parallel_for_each (T &container, F &&body, std::shared_ptr< ThreadPool > thread_pool=nullptr, size_t num_blocks=0, bool auto_wait=true)
 Parallel for each over a container, processing it in blocks for which the body function is executed individually. More...
 
template<typename F , typename T >
MultiFuture< void > parallel_for_each (T const begin, T const end, F &&body, std::shared_ptr< ThreadPool > thread_pool=nullptr, size_t num_blocks=0, bool auto_wait=true)
 Parallel for each over a container, processing it in blocks for which the body function is executed individually. More...
 

Macro Definition Documentation

◆ GENESIS_THREAD_CRITICAL_SECTION

#define GENESIS_THREAD_CRITICAL_SECTION (   TagName)
Value:
struct TagName {}; \
ThreadCriticalSection<TagName> genesis_critical_section_##TagName;

Definition at line 463 of file thread_functions.hpp.