We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

source_block::consume Method

Consumes a message previously offered by this source_block object and successfully reserved by the target, transferring ownership to the caller.

virtual message<_Target_type> * consume(
   runtime_object_identity _MsgId,
   ITarget<_Target_type> * _PTarget


The runtime_object_identity of the reserved message object.


A pointer to the target block that is calling the consume method.

A pointer to the message object that the caller now has ownership of.

The method throws an invalid_argument exception if the parameter _PTarget is NULL.

The method throws a bad_target exception if the parameter _PTarget does not represent the target that called reserve.

The consume method is similar to accept, but must always be preceded by a call to reserve that returned true.

Header: agents.h

Namespace: Concurrency