Compartir a través de


try_receive Function

A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false.

template <
   class _Type
>
bool try_receive(
   _Inout_ ISource<_Type> * _Src,
   _Type & _value
);

template <
   class _Type
>
bool try_receive(
   _Inout_ ISource<_Type> * _Src,
   _Type & _value,
   typename ITarget<_Type>::filter_method const& _Filter_proc
);

template <
   class _Type
>
bool try_receive(
   ISource<_Type> & _Src,
   _Type & _value
);

template <
   class _Type
>
bool try_receive(
   ISource<_Type> & _Src,
   _Type & _value,
   typename ITarget<_Type>::filter_method const& _Filter_proc
);

Parameters

  • _Type
    The payload type

  • _Src
    A pointer or reference to the source from which data is expected.

  • _value
    A reference to a location where the result will be placed.

  • _Filter_proc
    A filter function which determines whether messages should be accepted.

Return Value

A bool value indicating whether or not a payload was placed in _value.

Remarks

For more information, see Message Passing Functions.

Requirements

Header: agents.h

Namespace: concurrency

See Also

Reference

concurrency Namespace

receive Function

send Function

asend Function