receive Function
Visual Studio 2012
A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted.
template < class _Type > _Type receive( _Inout_ ISource<_Type> * _Src, unsigned int _Timeout = COOPERATIVE_TIMEOUT_INFINITE ); template < class _Type > _Type receive( _Inout_ ISource<_Type> * _Src, typename ITarget<_Type>::filter_method const& _Filter_proc, unsigned int _Timeout = COOPERATIVE_TIMEOUT_INFINITE ); template < class _Type > _Type receive( ISource<_Type> &_Src, unsigned int _Timeout = COOPERATIVE_TIMEOUT_INFINITE ); template < class _Type > _Type receive( ISource<_Type> &_Src, typename ITarget<_Type>::filter_method const& _Filter_proc, unsigned int _Timeout = COOPERATIVE_TIMEOUT_INFINITE );
If the parameter _Timeout has a value other than the constant COOPERATIVE_TIMEOUT_INFINITE, the exception operation_timed_out is thrown if the specified amount of time expires before a message is received. If you want a zero length timeout, you should use the try_receive function, as opposed to calling receive with a timeout of 0 (zero), as it is more efficient and does not throw exceptions on timeouts.
For more information, see Message Passing Functions.