| title | join Class | Microsoft Docs | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ms.custom | ||||||||||||||
| ms.date | 11/04/2016 | |||||||||||||
| ms.reviewer | ||||||||||||||
| ms.suite | ||||||||||||||
| ms.technology |
|
|||||||||||||
| ms.tgt_pltfrm | ||||||||||||||
| ms.topic | article | |||||||||||||
| f1_keywords |
|
|||||||||||||
| dev_langs |
|
|||||||||||||
| helpviewer_keywords |
|
|||||||||||||
| ms.assetid | d2217119-70a1-40b6-809f-c1c13a571c3f | |||||||||||||
| caps.latest.revision | 20 | |||||||||||||
| author | mikeblome | |||||||||||||
| ms.author | mblome | |||||||||||||
| manager | ghogen | |||||||||||||
| translation.priority.ht |
|
A join messaging block is a single-target, multi-source, ordered propagator_block which combines together messages of type T from each of its sources.
template<class T,
join_type _Jtype = non_greedy>
class join : public propagator_block<single_link_registry<ITarget<std::vector<T>>>,
multi_link_registry<ISource<T>>>;
T
The payload type of the messages joined and propagated by the block.
_Jtype
The kind of join block this is, either greedy or non_greedy
| Name | Description |
|---|---|
| join | Overloaded. Constructs a join messaging block. |
| ~join Destructor | Destroys the join block. |
| Name | Description |
|---|---|
| accept_message | Accepts a message that was offered by this join messaging block, transferring ownership to the caller. |
| consume_message | Consumes a message previously offered by the join messaging block and reserved by the target, transferring ownership to the caller. |
| link_target_notification | A callback that notifies that a new target has been linked to this join messaging block. |
| propagate_message | Asynchronously passes a message from an ISource block to this join messaging block. It is invoked by the propagate method, when called by a source block. |
| propagate_to_any_targets | Constructs an output message containing an input message from each source when they have all propagated a message. Sends this output message out to each of its targets. |
| release_message | Releases a previous message reservation. (Overrides source_block::release_message.) |
| reserve_message | Reserves a message previously offered by this join messaging block. (Overrides source_block::reserve_message.) |
| resume_propagation | Resumes propagation after a reservation has been released. (Overrides source_block::resume_propagation.) |
For more information, see Asynchronous Message Blocks.
join
Header: agents.h
Namespace: concurrency
Accepts a message that was offered by this join messaging block, transferring ownership to the caller.
virtual message<_OutputType>* accept_message(runtime_object_identity _MsgId);
_MsgId
The runtime_object_identity of the offered message object.
A pointer to the message object that the caller now has ownership of.
Consumes a message previously offered by the join messaging block and reserved by the target, transferring ownership to the caller.
virtual message<_OutputType>* consume_message(runtime_object_identity _MsgId);
_MsgId
The runtime_object_identity of the message object being consumed.
A pointer to the message object that the caller now has ownership of.
Similar to accept, but is always preceded by a call to reserve.
Constructs a join messaging block.
join(
size_t _NumInputs);
join(
size_t _NumInputs,
filter_method const& _Filter);
join(
Scheduler& _PScheduler,
size_t _NumInputs);
join(
Scheduler& _PScheduler,
size_t _NumInputs,
filter_method const& _Filter);
join(
ScheduleGroup& _PScheduleGroup,
size_t _NumInputs);
join(
ScheduleGroup& _PScheduleGroup,
size_t _NumInputs,
filter_method const& _Filter);
_NumInputs
The number of inputs this join block will be allowed.
_Filter
A filter function which determines whether offered messages should be accepted.
_PScheduler
The Scheduler object within which the propagation task for the join messaging block is scheduled.
_PScheduleGroup
The ScheduleGroup object within which the propagation task for the join messaging block is scheduled. The Scheduler object used is implied by the schedule group.
The runtime uses the default scheduler if you do not specify the _PScheduler or _PScheduleGroup parameters.
The type filter_method is a functor with signature bool (T const &) which is invoked by this join messaging block to determine whether or not it should accept an offered message.
Destroys the join block.
~join();
A callback that notifies that a new target has been linked to this join messaging block.
virtual void link_target_notification(_Inout_ ITarget<std::vector<T>> *);
Asynchronously passes a message from an ISource block to this join messaging block. It is invoked by the propagate method, when called by a source block.
message_status propagate_message(
_Inout_ message<T>* _PMessage,
_Inout_ ISource<T>* _PSource);
_PMessage
A pointer to the message object.
_PSource
A pointer to the source block offering the message.
A message_status indication of what the target decided to do with the message.
Constructs an output message containing an input message from each source when they have all propagated a message. Sends this output message out to each of its targets.
void propagate_to_any_targets(_Inout_opt_ message<_OutputType> *);
Releases a previous message reservation.
virtual void release_message(runtime_object_identity _MsgId);
_MsgId
The runtime_object_identity of the message object being released.
Reserves a message previously offered by this join messaging block.
virtual bool reserve_message(runtime_object_identity _MsgId);
_MsgId
The runtime_object_identity of the offered message object.
true if the message was successfully reserved, false otherwise.
After reserve is called, if it returns true, either consume or release must be called to either take or release ownership of the message.
Resumes propagation after a reservation has been released.
virtual void resume_propagation();