Documentation Home

Exchanges ownership of their associated shared_locks of execution between two std::shared_lock objects.

void swap(shared_lock&& other);

Effects:

If other owns a shared-ownership lock on a mutex prior to the call, that lock is now owned by *this. If *this owns a shared-ownership lock on a mutex prior to the call, that lock is now owned by other.

Postconditions:

this->mutex() is equal to the value of other.mutex() prior to the call. other.mutex() is equal to the value of this->mutex() prior to the call. this->owns_lock() is equal to the value of other.owns_lock() prior to the call. other.owns_lock() is equal to the value of this->owns_lock() prior to the call.

Throws:

Nothing

Header

#include <shared_mutex>

See Also