I recently looked at this std::thread reference.
For the move constructor it says:
thread( thread&& other );
Move constructor. Constructs the thread object to represent the thread of execution that was represented by
other. After this call other no longer represents a thread of
std::thread t3(f2, n);
std::thread t4(std::move(t3)); // t4 is now running f2(). t3 is no longer a thread
std::thread isn't a thread. It is a representation of a thread provided by an underlying operating system that you can use to manipulate the thread. This is just like a
car object isn't really a car.
move moves the thread being represented from one
std::thread to another. After the
t3 is a gutless
std::thread object is still there, but
t3 doesn't reference any actual system thread.
t4 now represents the thread previously represented by
t3, but it will not wait unless you call