glibmm: 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

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

Member Function Documentation

GRWLock* Glib::Threads::RWLock::gobj ( )
inline
RWLock& Glib::Threads::RWLock::operator= ( const RWLock )
delete
void Glib::Threads::RWLock::reader_lock ( )
bool Glib::Threads::RWLock::reader_trylock ( )
void Glib::Threads::RWLock::reader_unlock ( )
void Glib::Threads::RWLock::writer_lock ( )
bool Glib::Threads::RWLock::writer_trylock ( )
void Glib::Threads::RWLock::writer_unlock ( )