Kommentar
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
The source_block class is an abstract base class for source-only blocks. The class provides basic link management functionality as well as common error checks.
template<
class _TargetLinkRegistry,
class _MessageProcessorType = ordered_message_processor<typename _TargetLinkRegistry::type::type>
>
class source_block : public ISource<typename _TargetLinkRegistry::type::type>;
Parameters
_TargetLinkRegistry
Link registry to be used for holding the target links._MessageProcessorType
Processor type for message processing.
Members
Public Typedefs
Name |
Description |
|---|---|
target_iterator |
The iterator to walk the connected targets. |
Public Constructors
Name |
Description |
|---|---|
Constructs a source_block object. |
|
Destroys the source_block object. |
Public Methods
Name |
Description |
|---|---|
Accepts a message that was offered by this source_block object, transferring ownership to the caller. |
|
Acquires a reference count on this source_block object, to prevent deletion. |
|
Consumes a message previously offered by this source_block object and successfully reserved by the target, transferring ownership to the caller. |
|
Links a target block to this source_block object. |
|
Releases a previous successful message reservation. |
|
Releases a reference count on this source_block object. |
|
Reserves a message previously offered by this source_block object. |
|
Unlinks a target block from this source_block object. |
|
Unlinks all target blocks from this source_block object. (Overrides ISource::unlink_targets.) |
Protected Methods
Name |
Description |
|---|---|
When overridden in a derived class, accepts an offered message by the source. Message blocks should override this method to validate the _MsgId and return a message. |
|
Asynchronously queues up messages and starts a propagation task, if this has not been done already |
|
When overridden in a derived class, consumes a message that was previously reserved. |
|
Enables batched processing for this block. |
|
Initializes the message_propagator within this source_block. |
|
A callback that notifies that a new target has been linked to this source_block object. |
|
Process input messages. This is only useful for propagator blocks, which derive from source_block |
|
Propagate messages to targets. |
|
When overridden in a derived class, propagates the given message to any or all of the linked targets. This is the main propagation routine for message blocks. |
|
When overridden in a derived class, releases a previous message reservation. |
|
Removes all target links for this source block. This should be called from the destructor. |
|
When overridden in a derived class, reserves a message previously offered by this source_block object. |
|
When overridden in a derived class, resumes propagation after a reservation has been released. |
|
Synchronously queues up messages and starts a propagation task, if this has not been done already. |
|
A callback that notifies that a target has been unlinked from this source_block object. |
|
Waits for all asynchronous propagations to complete. This propagator-specific spin wait is used in destructors of message blocks to make sure that all asynchronous propagations have time to finish before destroying the block. |
Remarks
Message blocks should derive from this block to take advantage of link management and synchronization provided by this class.
Inheritance Hierarchy
source_block
Requirements
Header: agents.h
Namespace: concurrency