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_effects. 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(). When using host_object <T & > or host_object <void >, the underlying host state must remain live as long as a copy of the host_object is in scope.
Declared at: include/host_object.h:102
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()Declared at: include/host_object.h:108
¶explicit host_object(const instance_type& obj)
explicit host_object(const instance_type& obj)Declared at: include/host_object.h:109
Parameters
- const instance_type& obj
¶explicit host_object(instance_type&& obj)
explicit host_object(instance_type&& obj)Declared at: include/host_object.h:110
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.
Declared at: include/host_object.h:114
Template Parameters
- CtorParams
Parameters
- std::in_place_t
- CtorParams&&... ctor_args