std::jthread::operator=
来自cppreference.com
std::jthread& operator=( std::jthread&& other ) noexcept; |
(C++20 起) | |
若 *this 仍拥有关联的运行线程(即 joinable() == true),则调用 request_stop() 然后调用 join()。赋 other 的状态给 *this 并设置 other 为默认构造状态。
此调用后,this->get_id() 等于 other.get_id() 在调用前的值,关联的停止状态亦被移动,而 other 不再表示执行线程也不再拥有任何停止状态。
参数
other | - | 赋值给此 jthread 对象的另一 jthread 对象
|
返回值
*this