try_receive 関数
try-receive の一般的な実装です。これにより、コンテキストで 1 つのソースに対してのみデータの検索を実行し、受け取った値をフィルター処理できます。 データが準備されていない場合、メソッドは 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
);
パラメーター
_Type
ペイロードの種類_Src
データを取得するソースへのポインターまたは参照。_value
結果を格納する場所への参照。_Filter_proc
メッセージを受け付けるかどうかを決定するフィルター関数。
戻り値
_value にペイロードが格納されたかどうかを示す bool 値。
解説
詳細については、「メッセージ パッシング関数」を参照してください。
必要条件
ヘッダー: agents.h
名前空間: concurrency