STLdoc
STLdocumentation
|
An ordered_message_processor
is a message_processor
that allows message blocks to process messages in the order they were received.
More...
#include <agents.h>
Public Types | |
typedef std::tr1::function< void(message< _Type > *)> | _Handler_method |
The signature of the callback method invoked while processing messages. More... | |
typedef std::tr1::function< void(void)> | _Propagator_method |
The signature of the callback method invoked while propagating messages. More... | |
typedef _Type | type |
A type alias for _Type . More... | |
Public Member Functions | |
ordered_message_processor () | |
Constructs an ordered_message_processor object. More... | |
virtual | ~ordered_message_processor () |
Destroys the ordered_message_processor object. More... | |
void | initialize (_Inout_opt_ Scheduler *_PScheduler, _Inout_opt_ ScheduleGroup *_PScheduleGroup, _Handler_method const &_Handler) |
Initializes the ordered_message_processor object with the appropriate callback function, scheduler and schedule group. More... | |
virtual void | initialize_batched_processing (_Handler_method const &_Processor, _Propagator_method const &_Propagator) |
Initialize batched message processing More... | |
virtual void | sync_send (_Inout_opt_ message< _Type > *_Msg) |
Synchronously queues up messages and starts a processing task, if this has not been done already. More... | |
virtual void | async_send (_Inout_opt_ message< _Type > *_Msg) |
Asynchronously queues up messages and starts a processing task, if this has not been done already. More... | |
virtual void | wait () |
A processor-specific spin wait used in destructors of message blocks to make sure that all asynchronous processing tasks have time to finish before destroying the block. More... | |
Protected Member Functions | |
virtual void | process_incoming_message () |
The processing function that is called asynchronously. It dequeues messages and begins processing them. More... | |
Private Member Functions | |
void | _Clear_queued_messages () |
void | _Sync_send_helper (message< _Type > *_Msg) |
long | _Process_message_helper () |
void | _Invoke_handler (long _Count) |
void | _Invoke_handler (message< _Type > *_Msg) |
Private Attributes | |
concurrent_queue< message< _Type > * > | _M_queuedMessages |
A queue of the messages More... | |
::Concurrency::details::_NonReentrantPPLLock | _M_asyncSendLock |
A lock to use for queueing incoming messages. More... | |
volatile long | _M_queuedDataCount |
A count of the current number of messages to process. Used as a flag to see if a new process message task needs to be created. More... | |
Scheduler * | _M_pScheduler |
The scheduler to process messages on More... | |
ScheduleGroup * | _M_pScheduleGroup |
The schedule group to process messages on More... | |
volatile long | _M_stopProcessing |
A flag set in the destructor of a block to cease processing of new messages. This is required to guarantee that _M_queuedDataCount will get to 0 eventually. More... | |
volatile long | _M_lwtCount |
A counter to indicate the number of outstanding LWTs More... | |
_Handler_method | _M_handler |
A message handler object which exposes the callback to be invoked More... | |
_Handler_method | _M_processor |
A message processing object which exposes the callback to be invoked More... | |
_Propagator_method | _M_propagator |
A message propagating object which exposes the callback to be invoked More... | |
Additional Inherited Members |
An ordered_message_processor
is a message_processor
that allows message blocks to process messages in the order they were received.
_Type | The payload type of messages handled by the processor. |
typedef std::tr1::function<void(message<_Type> *)> Concurrency::ordered_message_processor< _Type >::_Handler_method |
The signature of the callback method invoked while processing messages.
typedef std::tr1::function<void(void)> Concurrency::ordered_message_processor< _Type >::_Propagator_method |
The signature of the callback method invoked while propagating messages.
typedef _Type Concurrency::ordered_message_processor< _Type >::type |
A type alias for _Type .
|
inline |
Constructs an ordered_message_processor
object.
This ordered_message_processor
will not schedule asynchronous or synchronous handlers until the initialize
function is called.
|
inlinevirtual |
Destroys the ordered_message_processor
object.
Waits for all outstanding asynchronous operations before destroying the processor.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlinevirtual |
Asynchronously queues up messages and starts a processing task, if this has not been done already.
_Msg | A pointer to a message. |
Implements Concurrency::message_processor< _Type >.
|
inline |
Initializes the ordered_message_processor
object with the appropriate callback function, scheduler and schedule group.
_PScheduler | A pointer to the scheduler to be used for scheduling light-weight tasks. |
_PScheduleGroup | A pointer to the schedule group to be used for scheduling light-weight tasks. |
_Handler | The handler functor invoked during callback. |
|
inlinevirtual |
Initialize batched message processing
_Processor | The processor functor invoked during callback. |
_Propagator | The propagator functor invoked during callback. |
|
inlineprotectedvirtual |
The processing function that is called asynchronously. It dequeues messages and begins processing them.
Implements Concurrency::message_processor< _Type >.
|
inlinevirtual |
Synchronously queues up messages and starts a processing task, if this has not been done already.
_Msg | A pointer to a message. |
Implements Concurrency::message_processor< _Type >.
|
inlinevirtual |
A processor-specific spin wait used in destructors of message blocks to make sure that all asynchronous processing tasks have time to finish before destroying the block.
Implements Concurrency::message_processor< _Type >.
|
private |
A lock to use for queueing incoming messages.
|
private |
A message handler object which exposes the callback to be invoked
|
private |
A counter to indicate the number of outstanding LWTs
|
private |
A message processing object which exposes the callback to be invoked
|
private |
A message propagating object which exposes the callback to be invoked
|
private |
The schedule group to process messages on
|
private |
The scheduler to process messages on
|
private |
A count of the current number of messages to process. Used as a flag to see if a new process message task needs to be created.
|
private |
A queue of the messages
|
private |
A flag set in the destructor of a block to cease processing of new messages. This is required to guarantee that _M_queuedDataCount will get to 0 eventually.