glibmm 2.66.5
Classes | Public Member Functions | List of all members
Glib::Threads::RWLock Class Reference

This represents a reader-writer lock. More...

#include <glibmm/threads.h>

Classes

class  ReaderLock
 Utility class for exception-safe locking of read/write locks. More...
 
class  WriterLock
 Utility class for exception-safe locking of read/write locks. More...
 

Public Member Functions

 RWLock ()
 
 RWLock (const RWLock &)=delete
 
RWLockoperator= (const RWLock &)=delete
 
 ~RWLock ()
 
void reader_lock ()
 
bool reader_trylock ()
 
void reader_unlock ()
 
void writer_lock ()
 
bool writer_trylock ()
 
void writer_unlock ()
 
GRWLock * gobj ()
 

Detailed Description

This represents a reader-writer lock.

It is similar to a Mutex in that it allows multiple threads to coordinate access to a shared resource.

The difference to a mutex is that a reader-writer lock discriminates between read-only ('reader') and full ('writer') access. While only one thread at a time is allowed write access (by holding the 'writer' lock via writer_lock()), multiple threads can gain simultaneous read-only access (by holding the 'reader' lock via reader_lock()).

Deprecated:
Please use std::lock_guard or std::unique_lock instead, with std::shared_timed_mutex.

Constructor & Destructor Documentation

◆ RWLock() [1/2]

Glib::Threads::RWLock::RWLock ( )

◆ RWLock() [2/2]

Glib::Threads::RWLock::RWLock ( const RWLock )
delete

◆ ~RWLock()

Glib::Threads::RWLock::~RWLock ( )

Member Function Documentation

◆ gobj()

GRWLock * Glib::Threads::RWLock::gobj ( )
inline

◆ operator=()

RWLock & Glib::Threads::RWLock::operator= ( const RWLock )
delete

◆ reader_lock()

void Glib::Threads::RWLock::reader_lock ( )

◆ reader_trylock()

bool Glib::Threads::RWLock::reader_trylock ( )

◆ reader_unlock()

void Glib::Threads::RWLock::reader_unlock ( )

◆ writer_lock()

void Glib::Threads::RWLock::writer_lock ( )

◆ writer_trylock()

bool Glib::Threads::RWLock::writer_trylock ( )

◆ writer_unlock()

void Glib::Threads::RWLock::writer_unlock ( )