Transfers ownership of a lock from one std::unique_lock object to another
std::unique_lock
object.
unique_lock& operator=(unique_lock&& other);
- Effects:
If
this->owns_lock()would returntrueprior to the call, callsthis->unlock(). Ifotherowned a lock on a mutex prior to the assignment, that lock is now owned by*this.- Postconditions:
this->mutex()is equal to the value ofother.mutex()prior to the assignment, andthis->owns_lock()is equal to the value ofother.owns_lock()prior to the assignment.other.mutex()==NULL,other.owns_lock()==false.- Throws:
Nothing
- Note:
std::unique_lockobjects are notCopyAssignable, so there is no copy-assignment operator, only this move-assignment operator.
Header
#include <mutex>