这man page指出
Instances of this class may also hold the special distinct value that does not represent any thread.
但是我到处都找不到这个特殊值是什么或者它是在哪里定义的(在
最佳答案
默认构造函数是这样记录的:
Default-constructs a new thread identifier. The identifier does not represent a thread.
因此,如果您想要非线程标识符,只需默认构造一个 id
。默认构造的值可以与任何线程 id
进行比较,以检查后者是否不是线程。
关于C++11 thread::id 表示无线程的特殊值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25973926/