Exchanges ownership of their associated threads of execution between
two std::thread
objects.
void swap(thread& other);
- Effects:
If
otherhas an associated thread of execution prior to the call, that thread of execution is now associated with*this. Otherwise*thishas no associated thread of execution. If*thishas an associated thread of execution prior to the call, that thread of execution is now associated withother. Otherwiseotherhas no associated thread of execution.- Postconditions:
this->get_id()is equal to the value ofother.get_id()prior to the call.other.get_id()is equal to the value ofthis->get_id()prior to the call.- Throws:
Nothing
Header
#include <thread>