class host_object
Declaration
template <typename T>
class host_object { /* full declaration omitted */ };
Description
A host_object
wraps state that exists separately on each worker node and can be referenced in host tasks through side_effect
s. Celerity ensures that access to the object state is properly synchronized and ordered. An example usage of a host object might be a file stream that is written to from multiple host tasks sequentially. - The generic host_object <T >
keeps ownership of the state at any time and is the safest way to achieve side effects on the host. - The host_object <T & >
specialization attaches Celerity's tracking and synchronization mechanism to user-managed state. The user guarantees that the referenced object is not accessed in any way other than through a side_effect
while the host_object
is live. - host_object <void >
does not carry internal state and can be used to track access to global variables or functions like printf()
.
Template Parameters
- T
Member Variables
- std::shared_ptr<tracker> m_tracker
Member Aliases
- using instance_type = T;
Member Function Overview
- host_object()
- host_object(const instance_type & obj) → explicit
- host_object(instance_type && obj) → explicit
- template <typename... CtorParams>
host_object(std::in_place_t, CtorParams &&... ctor_args) → explicit
Member Functions
¶host_object()
host_object()
¶explicit host_object(const instance_type& obj)
explicit host_object(const instance_type& obj)
Parameters
- const instance_type& obj
¶explicit host_object(instance_type&& obj)
explicit host_object(instance_type&& obj)
Parameters
- instance_type&& obj
¶template <typename... CtorParams>
explicit host_object(std::in_place_t,
CtorParams&&... ctor_args)
template <typename... CtorParams>
explicit host_object(std::in_place_t,
CtorParams&&... ctor_args)
Description
Constructs the object in-place with the given constructor arguments.
Template Parameters
- CtorParams
Parameters
- std::in_place_t
- CtorParams&&... ctor_args