lcos_local

The contents of this module can be included with the header hpx/modules/lcos_local.hpp. These headers may be used by user-code but are not guaranteed stable (neither header location nor contents). You are using these at your own risk. If you wish to use non-public functionality from a module we strongly suggest only including the module header hpx/modules/lcos_local.hpp, not the particular header in which the functionality you would like to use is defined. See Public API for a list of names that are part of the public HPX API.

Header hpx/lcos_local/and_gate.hpp

namespace hpx
namespace lcos
namespace local
struct and_gate : public hpx::lcos::local::base_and_gate<no_mutex>
#include <and_gate.hpp>

Public Functions

and_gate(std::size_t count = 0)
and_gate(and_gate &&rhs)
and_gate &operator=(and_gate &&rhs)
template<typename Lock>
future<void> get_future(Lock &l, std::size_t count = std::size_t(-1), std::size_t *generation_value = nullptr, error_code &ec = hpx::throws)
template<typename Lock>
shared_future<void> get_shared_future(Lock &l, std::size_t count = std::size_t(-1), std::size_t *generation_value = nullptr, error_code &ec = hpx::throws)
template<typename Lock>
bool set(std::size_t which, Lock &l, error_code &ec = throws)
template<typename Lock>
void synchronize(std::size_t generation_value, Lock &l, char const *function_name = "and_gate::synchronize", error_code &ec = throws)

Private Types

typedef base_and_gate<no_mutex> base_type
template<typename Mutex = lcos::local::spinlock>
struct base_and_gate
#include <and_gate.hpp>

Public Functions

base_and_gate(std::size_t count = 0)

This constructor initializes the base_and_gate object from the the number of participants to synchronize the control flow with.

base_and_gate(base_and_gate &&rhs)
base_and_gate &operator=(base_and_gate &&rhs)
future<void> get_future(std::size_t count = std::size_t(-1), std::size_t *generation_value = nullptr, error_code &ec = hpx::throws)
shared_future<void> get_shared_future(std::size_t count = std::size_t(-1), std::size_t *generation_value = nullptr, error_code &ec = hpx::throws)
bool set(std::size_t which, error_code &ec = throws)
void synchronize(std::size_t generation_value, char const *function_name = "base_and_gate<>::synchronize", error_code &ec = throws)

Wait for the generational counter to reach the requested stage.

std::size_t next_generation()
std::size_t generation() const

Protected Types

typedef Mutex mutex_type

Protected Functions

bool trigger_conditions(error_code &ec = throws)
template<typename OuterLock>
future<void> get_future(OuterLock &outer_lock, std::size_t count = std::size_t(-1), std::size_t *generation_value = nullptr, error_code &ec = hpx::throws)

get a future allowing to wait for the gate to fire

template<typename OuterLock>
shared_future<void> get_shared_future(OuterLock &outer_lock, std::size_t count = std::size_t(-1), std::size_t *generation_value = nullptr, error_code &ec = hpx::throws)

get a shared future allowing to wait for the gate to fire

template<typename OuterLock>
bool set(std::size_t which, OuterLock &outer_lock, error_code &ec = throws)

Set the data which has to go into the segment which.

bool test_condition(std::size_t generation_value)
template<typename Lock>
void synchronize(std::size_t generation_value, Lock &l, char const *function_name = "base_and_gate<>::synchronize", error_code &ec = throws)
template<typename OuterLock, typename Lock>
void init_locked(OuterLock &outer_lock, Lock &l, std::size_t count, error_code &ec = throws)

Private Types

typedef std::list<conditional_trigger*> condition_list_type

Private Members

mutex_type mtx_
boost::dynamic_bitset received_segments_
lcos::local::promise<void> promise_
std::size_t generation_
condition_list_type conditions_
struct manage_condition
#include <and_gate.hpp>

Public Functions

template<>
manage_condition(base_and_gate &gate, conditional_trigger &cond)
template<>
~manage_condition()
template<typename Condition>
future<void> get_future(Condition &&func, error_code &ec = hpx::throws)

Public Members

template<>
base_and_gate &this_
template<>
condition_list_type::iterator it_

Header hpx/lcos_local/channel.hpp

namespace hpx
namespace lcos
namespace local
template<typename T>
class channel : protected hpx::lcos::local::detail::channel_base<T>
#include <channel.hpp>

Public Types

typedef T value_type

Public Functions

channel()

Private Types

typedef detail::channel_base<T> base_type

Friends

friend hpx::lcos::local::channel_iterator< T >
friend hpx::lcos::local::receive_channel< T >
friend hpx::lcos::local::send_channel< T >
template<>
class channel<void> : protected hpx::lcos::local::detail::channel_base<void>
#include <channel.hpp>

Public Types

typedef void value_type

Public Functions

channel()

Private Types

typedef detail::channel_base<void> base_type

Friends

friend hpx::lcos::local::channel_iterator< void >
friend hpx::lcos::local::receive_channel< void >
friend hpx::lcos::local::send_channel< void >
template<typename T>
class channel_async_iterator : public hpx::util::iterator_facade<channel_async_iterator<T>, hpx::future<T>, std::input_iterator_tag, hpx::future<T>>
#include <channel.hpp>

Public Functions

channel_async_iterator()
channel_async_iterator(detail::channel_base<T> const *c)

Private Types

typedef hpx::util::iterator_facade<channel_async_iterator<T>, hpx::future<T>, std::input_iterator_tag, hpx::future<T>> base_type

Private Functions

std::pair<hpx::future<T>, bool> get_checked() const
bool equal(channel_async_iterator const &rhs) const
void increment()
base_type::reference dereference() const

Private Members

hpx::intrusive_ptr<detail::channel_impl_base<T>> channel_
std::pair<hpx::future<T>, bool> data_

Friends

friend hpx::lcos::local::hpx::util::iterator_core_access
template<typename T>
class channel_iterator : public hpx::util::iterator_facade<channel_iterator<T>, T const, std::input_iterator_tag>
#include <channel.hpp>

Public Functions

channel_iterator()
channel_iterator(detail::channel_base<T> const *c)
channel_iterator(receive_channel<T> const *c)

Private Types

typedef hpx::util::iterator_facade<channel_iterator<T>, T const, std::input_iterator_tag> base_type

Private Functions

std::pair<T, bool> get_checked() const
bool equal(channel_iterator const &rhs) const
void increment()
base_type::reference dereference() const

Private Members

hpx::intrusive_ptr<detail::channel_impl_base<T>> channel_
std::pair<T, bool> data_

Friends

friend hpx::lcos::local::hpx::util::iterator_core_access
template<>
class channel_iterator<void> : public hpx::util::iterator_facade<channel_iterator<void>, util::unused_type const, std::input_iterator_tag>
#include <channel.hpp>

Public Functions

channel_iterator()
channel_iterator(detail::channel_base<void> const *c)
channel_iterator(receive_channel<void> const *c)

Private Types

typedef hpx::util::iterator_facade<channel_iterator<void>, util::unused_type const, std::input_iterator_tag> base_type

Private Functions

bool get_checked()
bool equal(channel_iterator const &rhs) const
void increment()
base_type::reference dereference() const

Private Members

hpx::intrusive_ptr<detail::channel_impl_base<util::unused_type>> channel_
bool data_

Friends

friend hpx::lcos::local::hpx::util::iterator_core_access
template<typename T>
class one_element_channel : protected hpx::lcos::local::detail::channel_base<T>
#include <channel.hpp>

Public Types

typedef T value_type

Public Functions

one_element_channel()

Private Types

typedef detail::channel_base<T> base_type

Friends

friend hpx::lcos::local::channel_iterator< T >
friend hpx::lcos::local::receive_channel< T >
friend hpx::lcos::local::send_channel< T >
template<>
class one_element_channel<void> : protected hpx::lcos::local::detail::channel_base<void>
#include <channel.hpp>

Public Types

typedef void value_type

Public Functions

one_element_channel()

Private Types

typedef detail::channel_base<void> base_type

Friends

friend hpx::lcos::local::channel_iterator< void >
friend hpx::lcos::local::receive_channel< void >
friend hpx::lcos::local::send_channel< void >
template<typename T>
class receive_channel : protected hpx::lcos::local::detail::channel_base<T>
#include <channel.hpp>

Public Functions

receive_channel(channel<T> const &c)
receive_channel(one_element_channel<T> const &c)

Private Types

typedef detail::channel_base<T> base_type

Friends

friend hpx::lcos::local::channel_iterator< T >
friend hpx::lcos::local::send_channel< T >
template<>
class receive_channel<void> : protected hpx::lcos::local::detail::channel_base<void>
#include <channel.hpp>

Public Functions

receive_channel(channel<void> const &c)
receive_channel(one_element_channel<void> const &c)

Private Types

typedef detail::channel_base<void> base_type

Friends

friend hpx::lcos::local::channel_iterator< void >
friend hpx::lcos::local::send_channel< void >
template<typename T>
class send_channel : private hpx::lcos::local::detail::channel_base<T>
#include <channel.hpp>

Public Functions

send_channel(channel<T> const &c)
send_channel(one_element_channel<T> const &c)

Private Types

typedef detail::channel_base<T> base_type
template<>
class send_channel<void> : private hpx::lcos::local::detail::channel_base<void>
#include <channel.hpp>

Public Functions

send_channel(channel<void> const &c)
send_channel(one_element_channel<void> const &c)

Private Types

typedef detail::channel_base<void> base_type

Header hpx/lcos_local/composable_guard.hpp

namespace hpx
namespace lcos
namespace local

Functions

void run_guarded(guard &guard, detail::guard_function task)

Conceptually, a guard acts like a mutex on an asynchronous task. The mutex is locked before the task runs, and unlocked afterwards.

template<typename F, typename ...Args>
void run_guarded(guard &guard, F &&f, Args&&... args)
void run_guarded(guard_set &guards, detail::guard_function task)

Conceptually, a guard_set acts like a set of mutexes on an asynchronous task. The mutexes are locked before the task runs, and unlocked afterwards.

template<typename F, typename ...Args>
void run_guarded(guard_set &guards, F &&f, Args&&... args)
class guard : public hpx::lcos::local::detail::debug_object
#include <composable_guard.hpp>

Public Functions

guard()
~guard()

Public Members

detail::guard_atomic task
class guard_set : public hpx::lcos::local::detail::debug_object
#include <composable_guard.hpp>

Public Functions

guard_set()
~guard_set()
std::shared_ptr<guard> get(std::size_t i)
void add(std::shared_ptr<guard> const &guard_ptr)
std::size_t size()

Private Functions

void sort()

Private Members

std::vector<std::shared_ptr<guard>> guards
bool sorted

Friends

void run_guarded(guard_set &guards, detail::guard_function task)

Conceptually, a guard_set acts like a set of mutexes on an asynchronous task. The mutexes are locked before the task runs, and unlocked afterwards.

Header hpx/lcos_local/conditional_trigger.hpp

namespace hpx
namespace lcos
namespace local
struct conditional_trigger
#include <conditional_trigger.hpp>

Public Functions

conditional_trigger()
conditional_trigger(conditional_trigger &&rhs)
conditional_trigger &operator=(conditional_trigger &&rhs)
template<typename Condition>
future<void> get_future(Condition &&func, error_code &ec = hpx::throws)

get a future allowing to wait for the trigger to fire

void reset()
bool set(error_code &ec = throws)

Trigger this object.

Private Members

lcos::local::promise<void> promise_
util::function_nonser<bool()> cond_

Header hpx/lcos_local/packaged_task.hpp

namespace hpx
namespace lcos
namespace local
template<typename R, typename ...Ts>
class packaged_task<R(Ts...)>
#include <packaged_task.hpp>

Public Functions

packaged_task()
template<typename F, typename FD = typename std::decay<F>::type, typename Enable = typename std::enable_if<!std::is_same<FD, packaged_task>::value && traits::is_invocable_r<R, FD&, Ts...>::value>::type>
packaged_task(F &&f)
template<typename Allocator, typename F, typename FD = typename std::decay<F>::type, typename Enable = typename std::enable_if<!std::is_same<FD, packaged_task>::value && traits::is_invocable_r<R, FD&, Ts...>::value>::type>
packaged_task(std::allocator_arg_t, Allocator const &a, F &&f)
packaged_task(packaged_task &&rhs)
packaged_task &operator=(packaged_task &&rhs)
void swap(packaged_task &rhs)
void operator()(Ts... vs)
lcos::future<R> get_future(error_code &ec = throws)
bool valid() const
void reset(error_code &ec = throws)
void set_exception(std::exception_ptr const &e)

Private Types

typedef util::unique_function_nonser<R(Ts...)> function_type

Private Functions

template<typename ...Vs>
void invoke_impl(std::false_type, Vs&&... vs)
template<typename ...Vs>
void invoke_impl(std::true_type, Vs&&... vs)

Private Members

function_type function_
local::promise<R> promise_

Header hpx/lcos_local/promise.hpp

namespace hpx
namespace lcos
namespace local

Functions

template<typename R>
void swap(promise<R> &x, promise<R> &y)
template<typename R>
class promise : public hpx::lcos::local::detail::promise_base<R>
#include <promise.hpp>

Public Functions

promise()
template<typename Allocator>
promise(std::allocator_arg_t, Allocator const &a)
promise(promise &&other)
~promise()
promise &operator=(promise &&other)
void swap(promise &other)
bool valid() const
void set_value(R const &r)
void set_value(R &&r)
template<typename ...Ts>
void set_value(Ts&&... ts)
void set_exception(std::exception_ptr e)

Private Types

typedef detail::promise_base<R> base_type
template<typename R>
class promise<R&> : public hpx::lcos::local::detail::promise_base<R&>
#include <promise.hpp>

Public Functions

promise()
template<typename Allocator>
promise(std::allocator_arg_t, Allocator const &a)
promise(promise &&other)
~promise()
promise &operator=(promise &&other)
void swap(promise &other)
bool valid() const
void set_value(R &r)
void set_exception(std::exception_ptr e)

Private Types

typedef detail::promise_base<R&> base_type
template<>
class promise<void> : public hpx::lcos::local::detail::promise_base<void>
#include <promise.hpp>

Public Functions

promise()
template<typename Allocator>
promise(std::allocator_arg_t, Allocator const &a)
promise(promise &&other)
~promise()
promise &operator=(promise &&other)
void swap(promise &other)
bool valid() const
void set_value()
void set_exception(std::exception_ptr e)

Private Types

typedef detail::promise_base<void> base_type

Header hpx/lcos_local/receive_buffer.hpp

namespace hpx
namespace lcos
namespace local
template<typename T, typename Mutex = lcos::local::spinlock>
struct receive_buffer
#include <receive_buffer.hpp>

Public Functions

receive_buffer()
receive_buffer(receive_buffer &&other)
~receive_buffer()
receive_buffer &operator=(receive_buffer &&other)
hpx::future<T> receive(std::size_t step)
bool try_receive(std::size_t step, hpx::future<T> *f = nullptr)
template<typename Lock = hpx::lcos::local::no_mutex>
void store_received(std::size_t step, T &&val, Lock *lock = nullptr)
bool empty() const
std::size_t cancel_waiting(std::exception_ptr const &e, bool force_delete_entries = false)

Protected Types

typedef Mutex mutex_type
typedef hpx::lcos::local::promise<T> buffer_promise_type
typedef std::map<std::size_t, std::shared_ptr<entry_data>> buffer_map_type
typedef buffer_map_type::iterator iterator

Protected Functions

iterator get_buffer_entry(std::size_t step)

Private Members

mutex_type mtx_
buffer_map_type buffer_map_
struct entry_data
#include <receive_buffer.hpp>

Public Functions

template<>
HPX_NON_COPYABLE(entry_data)
template<>
entry_data()
template<>
hpx::future<T> get_future()
template<typename Val>
void set_value(Val &&val)
template<>
bool cancel(std::exception_ptr const &e)

Public Members

template<>
buffer_promise_type promise_
template<>
bool can_be_deleted_
template<>
bool value_set_
struct erase_on_exit
#include <receive_buffer.hpp>

Public Functions

template<>
erase_on_exit(buffer_map_type &buffer_map, iterator it)
template<>
~erase_on_exit()

Public Members

template<>
buffer_map_type &buffer_map_
template<>
iterator it_
template<typename Mutex>
struct receive_buffer<void, Mutex>
#include <receive_buffer.hpp>

Public Functions

receive_buffer()
receive_buffer(receive_buffer &&other)
~receive_buffer()
receive_buffer &operator=(receive_buffer &&other)
hpx::future<void> receive(std::size_t step)
bool try_receive(std::size_t step, hpx::future<void> *f = nullptr)
template<typename Lock = hpx::lcos::local::no_mutex>
void store_received(std::size_t step, Lock *lock = nullptr)
bool empty() const
std::size_t cancel_waiting(std::exception_ptr const &e, bool force_delete_entries = false)

Protected Types

typedef Mutex mutex_type
typedef hpx::lcos::local::promise<void> buffer_promise_type
typedef std::map<std::size_t, std::shared_ptr<entry_data>> buffer_map_type
typedef buffer_map_type::iterator iterator

Protected Functions

iterator get_buffer_entry(std::size_t step)

Private Members

mutex_type mtx_
buffer_map_type buffer_map_
template<>
struct entry_data
#include <receive_buffer.hpp>

Public Functions

template<>
HPX_NON_COPYABLE(entry_data)
template<>
entry_data()
template<>
hpx::future<void> get_future()
template<>
void set_value()
template<>
bool cancel(std::exception_ptr const &e)

Public Members

template<>
buffer_promise_type promise_
template<>
bool can_be_deleted_
template<>
bool value_set_
template<>
struct erase_on_exit
#include <receive_buffer.hpp>

Public Functions

template<>
erase_on_exit(buffer_map_type &buffer_map, iterator it)
template<>
~erase_on_exit()

Public Members

template<>
buffer_map_type &buffer_map_
template<>
iterator it_

Header hpx/lcos_local/trigger.hpp

namespace hpx
namespace lcos
namespace local
template<typename Mutex = lcos::local::spinlock>
struct base_trigger
#include <trigger.hpp>

Public Functions

base_trigger()
base_trigger(base_trigger &&rhs)
base_trigger &operator=(base_trigger &&rhs)
future<void> get_future(std::size_t *generation_value = nullptr, error_code &ec = hpx::throws)

get a future allowing to wait for the trigger to fire

bool set(error_code &ec = throws)

Trigger this object.

void synchronize(std::size_t generation_value, char const *function_name = "base_and_gate<>::synchronize", error_code &ec = throws)

Wait for the generational counter to reach the requested stage.

std::size_t next_generation()
std::size_t generation() const

Protected Types

typedef Mutex mutex_type

Protected Functions

bool trigger_conditions(error_code &ec = throws)
template<typename Lock>
void synchronize(std::size_t generation_value, Lock &l, char const *function_name = "base_and_gate<>::synchronize", error_code &ec = throws)

Private Types

typedef std::list<conditional_trigger*> condition_list_type

Private Functions

bool test_condition(std::size_t generation_value)

Private Members

mutex_type mtx_
lcos::local::promise<void> promise_
std::size_t generation_
condition_list_type conditions_
struct manage_condition

Public Functions

template<>
manage_condition(base_trigger &gate, conditional_trigger &cond)
template<>
~manage_condition()
template<typename Condition>
future<void> get_future(Condition &&func, error_code &ec = hpx::throws)

Public Members

template<>
base_trigger &this_
template<>
condition_list_type::iterator it_
struct trigger : public hpx::lcos::local::base_trigger<no_mutex>
#include <trigger.hpp>

Public Functions

trigger()
trigger(trigger &&rhs)
trigger &operator=(trigger &&rhs)
template<typename Lock>
void synchronize(std::size_t generation_value, Lock &l, char const *function_name = "trigger::synchronize", error_code &ec = throws)

Private Types

typedef base_trigger<no_mutex> base_type

Header hpx/local/channel.hpp