C++11threadoperator=(7)
原文地址:http://www.cplusplus.com/reference/thread/thread/operator=/
public member function
std::thread::operator=
move (1)
thread& operator= (thread&& rhs) noexcept;
copy [deleted] (2)
thread& operator= (const thread&) = delete;
Move-assign thread
If the object is currently not joinable, it acquires the thread of execution represented by rhs (if any).
如果对象现在是非joinable,将获取rhs的执行线程。
If it is joinable, [terminate()](http://www.cplusplus.com/terminate)
is called.
如果是joinable,将调用terminate().
After the call, rhs no longer represents any thread of execution (as if default-constructed).
调用之后,rhs不再执行任何线程。
thread objects cannot be copied (2).
线程对象不能被复制。
Parameters
rhs
thread object whose state is moved to *this
.
将被移动到现在线程的线程rhs.
Return value
*this
返回该线程。
Example
1 | 1 |
1 | // example for thread::operator= |
Output (after 5 seconds):
Spawning 5 threads…
Done spawning threads. Now waiting for them to join:
pause of 1 seconds ended
pause of 2 seconds ended
pause of 3 seconds ended
pause of 4 seconds ended
pause of 5 seconds ended
All threads joined!
Data races
Both rhs and the object are modified.
Exception safety
No-throw guarantee: never throws exceptions.
—————————————————————————————————————————————————————————————————
//写的错误或者不好的地方请多多指导,可以在下面留言或者点击左上方邮件地址给我发邮件,指出我的错误以及不足,以便我修改,更好的分享给大家,谢谢。
转载请注明出处:http://blog.csdn.net/qq844352155
author:天下无双
Email:coderguang@gmail.com
2014-9-4
于GDUT
——————————————————————————————————————————————————————————————————
- 本文作者: royalchen
- 本文链接: http://www.royalchen.com/2016/02/24/c11threadoperator7/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!