libcosmos
Linux C++ System Programming Library
Loading...
Searching...
No Matches
cosmos::WriteLockGuard Struct Reference

A lock-guard object that locks an RWLock for writing until it is destroyed. More...

#include <RWLock.hxx>

+ Inheritance diagram for cosmos::WriteLockGuard:

Public Member Functions

 WriteLockGuard (const RWLock &rwl)
 
- Public Member Functions inherited from cosmos::ResourceGuard< const RWLock & >
 ResourceGuard (const ResourceGuard &)=delete
 
 ResourceGuard (const RWLock &r, std::function< CleanFunc > cleaner)
 
ResourceGuardoperator= (const ResourceGuard &)=delete
 
void disarm ()
 

Additional Inherited Members

- Public Types inherited from cosmos::ResourceGuard< const RWLock & >
using CleanFunc
 
- Protected Attributes inherited from cosmos::ResourceGuard< const RWLock & >
bool m_disarmed
 
const RWLockm_res
 
std::function< CleanFunc > m_cleaner
 

Detailed Description

A lock-guard object that locks an RWLock for writing until it is destroyed.

Definition at line 79 of file RWLock.hxx.

Constructor & Destructor Documentation

◆ WriteLockGuard()

cosmos::WriteLockGuard::WriteLockGuard ( const RWLock & rwl)
inlineexplicit

Definition at line 82 of file RWLock.hxx.

82 :
83 ResourceGuard{rwl, [](const RWLock &_rwl) { _rwl.unlock(); }} {
84 rwl.writelock();
85 }

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