Namespaces
Variants

std::stop_source:: stop_source

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
stop_source ( ) ;
(1) (C++20以降)
explicit stop_source ( std:: nostopstate_t nss ) noexcept ;
(2) (C++20以降)
stop_source ( const stop_source & other ) noexcept ;
(3) (C++20以降)
stop_source ( stop_source && other ) noexcept ;
(4) (C++20以降)

新しい stop_source オブジェクトを構築します。

1) 新しい停止状態を持つ stop_source を構築します。
2) 関連する停止状態を持たない空の stop_source を構築します。
3) コピーコンストラクタ。 stop_source の関連付けられた停止状態が other のものと同じである stop_source を構築します。
4) ムーブコンストラクタ。関連する停止状態が other と同じである stop_source を構築する。 other は空の状態になる。

パラメータ

nss - 空の stop_source を構築するための std::nostopstate_t プレースホルダーオブジェクト
other - この stop_source オブジェクトを構築するための別の stop_source オブジェクト

事後条件

1) stop_possible() true であり、 stop_requested() false です。
2) stop_possible() および stop_requested() は両方とも false です。
3) * this other は同じ関連付けられた停止状態を共有し、等価であると比較されます。
4) * this other の以前に関連付けられた停止状態を持ち、かつ other. stop_possible ( ) false である。

例外

1) std::bad_alloc ストップ状態のためにメモリを割り当てられなかった場合。