You can't get a std::thread
object referring to a thread that wasn't created by the std::thread
constructor. Either consistently use the C++ thread library, or don't use it at all. If the current thread was created by pthread_create
, for example, it will need to be joined to using pthread_join
.