The Pedigree Project 0.1
Public Member Functions | Private Attributes | List of all members
UnlikelyLock Class Reference

#include <UnlikelyLock.h>

+ Collaboration diagram for UnlikelyLock:

Public Member Functions

void enter ()
 
void leave ()
 
void acquire ()
 
void release ()
 

Private Attributes

Mutex m_Lock
 
ConditionVariable m_Condition
 
uint64_t m_nReaders
 
uint64_t m_nWaitingWriters
 
bool m_bActiveWriter
 

Detailed Description

A reader/writer lock optimised for the case where exclusive access is rare.

Admission waits internally until ownership is available. Signal delivery remains visible to the outer operation, but cannot make a caller retry and accidentally lose the interruption or bypass lock ownership.

Definition at line 41 of file UnlikelyLock.h.

Constructor & Destructor Documentation

◆ UnlikelyLock()

UnlikelyLock::UnlikelyLock ( )

Definition at line 24 of file UnlikelyLock.cc.

◆ ~UnlikelyLock()

UnlikelyLock::~UnlikelyLock ( )

Definition at line 27 of file UnlikelyLock.cc.

Member Function Documentation

◆ acquire()

void UnlikelyLock::acquire ( )

◆ enter()

void UnlikelyLock::enter ( )

Enters the critical section after all active writers have left.

Definition at line 34 of file UnlikelyLock.cc.

References ConditionVariable::waitForCompletion().

Referenced by PosixSubsystem::getSignalDisposition(), and PosixSubsystem::PosixSubsystem().

+ Here is the caller graph for this function:

◆ leave()

void UnlikelyLock::leave ( )

Leaving the critical section.

Definition at line 43 of file UnlikelyLock.cc.

References ConditionVariable::broadcast().

Referenced by PosixSubsystem::getSignalDisposition(), and PosixSubsystem::PosixSubsystem().

+ Here is the caller graph for this function:

◆ release()

void UnlikelyLock::release ( )

Member Data Documentation

◆ m_bActiveWriter

bool UnlikelyLock::m_bActiveWriter
private

Definition at line 65 of file UnlikelyLock.h.

◆ m_Condition

ConditionVariable UnlikelyLock::m_Condition
private

Definition at line 61 of file UnlikelyLock.h.

◆ m_Lock

Mutex UnlikelyLock::m_Lock
private

Definition at line 60 of file UnlikelyLock.h.

◆ m_nReaders

uint64_t UnlikelyLock::m_nReaders
private

Definition at line 63 of file UnlikelyLock.h.

◆ m_nWaitingWriters

uint64_t UnlikelyLock::m_nWaitingWriters
private

Definition at line 64 of file UnlikelyLock.h.


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