struct final
#include <src/vt/messaging/pending_send.h>
PendingSend A pending send (or other similar operation) that is delayed until this holder goes out of scope.
PendingSend
holds the message and dispatch function for a send (or broadcast or similar event) to a node, collection, objgroup, etc. This allows VT to expand the DAG before it actually violates a data or control dependency by expanding and prematurely performing the operation. We can then wire future sends up with past ones by associating future events with termination sequencing—see CollectionChainSet
Public types
- using SendActionType = std::function<void(MsgSharedPtr<BaseMsgType>&)>
- Function for complex action on send—takes a message to operate on.
- using EpochActionType = std::function<void()>
Constructors, destructors, conversion operators
- PendingSend(MsgSharedPtr<BaseMsgType>& in_msg, SendActionType in_action = nullptr)
- Construct a pending send.
-
template<typename MsgT>PendingSend(MsgSharedPtr<MsgT>& in_msg, SendActionType in_action)
- Construct a pending send that invokes a callback.
- PendingSend(EpochType ep, EpochActionType const& in_action)
- Construct a pending send to push an epoch.
- PendingSend(std::nullptr_t) explicit
- PendingSend(PendingSend&& in) noexcept
- PendingSend(const PendingSend&) deleted
- ~PendingSend()
- Release the pending send on destruction (when this goes out of scope)
Public functions
- auto operator=(PendingSend&& in) -> PendingSend& deleted
- auto operator=(PendingSend& in) -> PendingSend& deleted
- void release()
- Release the message, run action if needed.
- auto getMsg() -> MsgPtr<BaseMsgType>&
- Get the message stored in the pending send.
Function documentation
vt:: messaging:: PendingSend:: PendingSend(MsgSharedPtr<BaseMsgType>& in_msg,
SendActionType in_action = nullptr)
Construct a pending send.
Parameters | |
---|---|
in_msg in | the message to send |
in_action in | the "send" action to run, if overridden. |
This is the preferred form, especially for internal constructs. If an action is specified it will be run. Otherwise the default internal message-sending action is applied.
template<typename MsgT>
vt:: messaging:: PendingSend:: PendingSend(MsgSharedPtr<MsgT>& in_msg,
SendActionType in_action)
Construct a pending send that invokes a callback.
Parameters | |
---|---|
in_msg in | the message to send |
in_action in | the "send" action to run |
This constructor is for a complex PendingSend
that holds a std::function
for performing the send (e.g., sending to a collection element). When released, it will run the in_action
of type SendActionType
.
vt:: messaging:: PendingSend:: PendingSend(EpochType ep,
EpochActionType const& in_action)
Construct a pending send to push an epoch.
Parameters | |
---|---|
ep | |
in_action in | the "send" action to run |
vt:: messaging:: PendingSend:: ~PendingSend()
Release the pending send on destruction (when this goes out of scope)
{ auto ps = vt::theMsg()->sendMsg<MyMsg, handler>(msg); } // Message is sent here when the destructor runs // Message is sent right away on this following line as the PendingSend // is not captured vt::theMsg()->sendMsg<MyMsg, handler>(msg);
MsgPtr<BaseMsgType>& vt:: messaging:: PendingSend:: getMsg()
Get the message stored in the pending send.
Returns | a reference to the message |
---|