Exchanges ownership of their associated unique_locks of execution between
two std::unique_lock
objects.
void swap(unique_lock&& other);
- Effects:
If
otherowns a lock on a mutex prior to the call, that lock is now owned by*this. If*thisowns a lock on a mutex prior to the call, that lock is now owned byother.- Postconditions:
this->mutex()is equal to the value ofother.mutex()prior to the call.other.mutex()is equal to the value ofthis->mutex()prior to the call.this->owns_lock()is equal to the value ofother.owns_lock()prior to the call.other.owns_lock()is equal to the value ofthis->owns_lock()prior to the call.- Throws:
Nothing
Header
#include <mutex>