Ream v0.1.0-1
C++ graphics library for Linux
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
RLockGuard Struct Reference

RAII guard that serializes access to Ream's global lock. More...

#include <RLockGuard.h>

Public Member Functions

 RLockGuard () noexcept
 Acquires the global lock for the duration of this scope.
 
 ~RLockGuard () noexcept
 Releases the lock if this guard acquired it.
 

Static Public Member Functions

static bool Lock () noexcept
 Locks the global mutex for the calling thread.
 
static bool Unlock () noexcept
 Unlocks the global mutex previously acquired by the calling thread.
 

Detailed Description

RAII guard that serializes access to Ream's global lock.

The lock is recursive per-thread: acquiring it while the current thread already holds it is a no-op, and only the outermost guard releases it on destruction.

Note
Meant for internal use.

Constructor & Destructor Documentation

◆ RLockGuard()

RLockGuard ( )
inlinenoexcept

Acquires the global lock for the duration of this scope.

◆ ~RLockGuard()

~RLockGuard ( )
inlinenoexcept

Releases the lock if this guard acquired it.

Member Function Documentation

◆ Lock()

static bool Lock ( )
staticnoexcept

Locks the global mutex for the calling thread.

Returns
true if the lock was acquired, false if the current thread already held it.

◆ Unlock()

static bool Unlock ( )
staticnoexcept

Unlocks the global mutex previously acquired by the calling thread.

Returns
true if the lock was released, false if the current thread did not hold it.