libfilezilla
Public Member Functions | List of all members
scoped_read_lock Class Referencefinal

A simple scoped read lock. More...

#include <rwmutex.hpp>

Public Member Functions

 scoped_read_lock (rwmutex &m)
 
 scoped_read_lock (scoped_read_lock const &)=delete
 
scoped_read_lockoperator= (scoped_read_lock const &)=delete
 
 scoped_read_lock (scoped_read_lock &&op) noexcept
 
scoped_read_lockoperator= (scoped_read_lock &&op) noexcept
 
void lock ()
 Obtains the mutex. More...
 
void unlock ()
 Releases the mutex. More...
 

Detailed Description

A simple scoped read lock.

The lock is acquired on construction and, if still locked, released on destruction. You can manually unlock and re-lock if needed.

There can be multiple readers. If there is a writer there's no readers and no other writer.

Member Function Documentation

◆ lock()

void lock ( )
inline

Obtains the mutex.

Locking an already locked scoped_read_lock results in undefined behavior.

◆ unlock()

void unlock ( )
inline

Releases the mutex.

Releasing a scoped_read_lock that isn't locked results in undefined behavior.


The documentation for this class was generated from the following file: