Documentation Home

Transfers ownership of a shared-ownership lock from one std::shared_lock object to another std::shared_lock object.

shared_lock& operator=(shared_lock&& other);

Effects:

If this->owns_lock() would return true prior to the call, calls this->unlock_shared(). If other owned a shared-ownership lock on a mutex prior to the assignment, that lock is now owned by *this.

Postconditions:

this->mutex() is equal to the value of other.mutex() prior to the assignment, and this->owns_lock() is equal to the value of other.owns_lock() prior to the assignment. other.mutex()==NULL, other.owns_lock()==false.

Throws:

Nothing

Note:

std::shared_lock objects are not CopyAssignable, so there is no copy-assignment operator, only this move-assignment operator.

Header

#include <shared_mutex>

See Also