Is there a null value for std :: thread :: id?

I would like to have a member of a class like std::thread::id , where I can also nullify it and then check if it has been installed.

What is the best way to β€œzero out” this type and then check if it has been installed?

+8
c ++ multithreading c ++ 11
source share
1 answer

According to cppreference in std :: thread :: id (default constructor) :

By default, a new stream identifier is created. The identifier does not represent a stream.

So you can store and compare with the default built std::thread::id .

+13
source share

All Articles