LibreOffice Module comphelper (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
comphelper::SolarMutex Class Reference

SolarMutex, needed for VCL's Application::GetSolarMutex(). More...

#include <solarmutex.hxx>

Public Types

typedef void(* BeforeReleaseHandler) ()
 

Public Member Functions

 SolarMutex ()
 
virtual ~SolarMutex ()
 
void SetBeforeReleaseHandler (const BeforeReleaseHandler &rLink)
 
void acquire (sal_uInt32 nLockCount=1)
 
sal_uInt32 release (bool bUnlockAll=false)
 
virtual bool tryToAcquire ()
 
virtual bool IsCurrentThread () const
 

Static Public Member Functions

static SolarMutexget ()
 Help components to get the SolarMutex easily. More...
 

Protected Member Functions

virtual sal_uInt32 doRelease (bool bUnlockAll)
 
virtual void doAcquire (sal_uInt32 nLockCount)
 

Protected Attributes

osl::Mutex m_aMutex
 
sal_uInt32 m_nCount
 

Private Member Functions

 SolarMutex (const SolarMutex &)=delete
 
SolarMutexoperator= (const SolarMutex &)=delete
 

Private Attributes

std::atomic< std::thread::id > m_nThreadId
 
BeforeReleaseHandler m_aBeforeReleaseHandler
 

Detailed Description

SolarMutex, needed for VCL's Application::GetSolarMutex().

The SolarMutex is the one big recursive code lock used to protect the vast majority of the LibreOffice code-base, in particular anything that is graphical and the cores of the applications.

Treat this as a singleton, as its constructor sets a global pointing at itself.

Definition at line 46 of file solarmutex.hxx.

Member Typedef Documentation

◆ BeforeReleaseHandler

typedef void(* comphelper::SolarMutex::BeforeReleaseHandler) ()

Definition at line 48 of file solarmutex.hxx.

Constructor & Destructor Documentation

◆ SolarMutex() [1/2]

comphelper::SolarMutex::SolarMutex ( )

Definition at line 39 of file solarmutex.cxx.

References m_nCount.

◆ ~SolarMutex()

comphelper::SolarMutex::~SolarMutex ( )
virtual

Definition at line 47 of file solarmutex.cxx.

◆ SolarMutex() [2/2]

comphelper::SolarMutex::SolarMutex ( const SolarMutex )
privatedelete

Member Function Documentation

◆ acquire()

void comphelper::SolarMutex::acquire ( sal_uInt32  nLockCount = 1)
inline

Definition at line 83 of file solarmutex.hxx.

References doAcquire().

◆ doAcquire()

void comphelper::SolarMutex::doAcquire ( sal_uInt32  nLockCount)
protectedvirtual

Definition at line 52 of file solarmutex.cxx.

References m_aMutex, m_nCount, m_nThreadId, and n.

Referenced by acquire().

◆ doRelease()

sal_uInt32 comphelper::SolarMutex::doRelease ( bool  bUnlockAll)
protectedvirtual

Definition at line 60 of file solarmutex.cxx.

References IsCurrentThread(), m_aBeforeReleaseHandler, m_aMutex, m_nCount, m_nThreadId, n, and nCount.

Referenced by release().

◆ get()

SolarMutex * comphelper::SolarMutex::get ( )
static

◆ IsCurrentThread()

bool comphelper::SolarMutex::IsCurrentThread ( ) const
virtual

Definition at line 83 of file solarmutex.cxx.

References m_nThreadId.

Referenced by doRelease().

◆ operator=()

SolarMutex & comphelper::SolarMutex::operator= ( const SolarMutex )
privatedelete

◆ release()

sal_uInt32 comphelper::SolarMutex::release ( bool  bUnlockAll = false)
inline

Definition at line 89 of file solarmutex.hxx.

References doRelease().

◆ SetBeforeReleaseHandler()

void comphelper::SolarMutex::SetBeforeReleaseHandler ( const BeforeReleaseHandler rLink)
inline

Definition at line 53 of file solarmutex.hxx.

◆ tryToAcquire()

bool comphelper::SolarMutex::tryToAcquire ( )
virtual

Definition at line 88 of file solarmutex.cxx.

References m_aMutex, m_nCount, and m_nThreadId.

Member Data Documentation

◆ m_aBeforeReleaseHandler

BeforeReleaseHandler comphelper::SolarMutex::m_aBeforeReleaseHandler
private

Definition at line 80 of file solarmutex.hxx.

Referenced by doRelease().

◆ m_aMutex

osl::Mutex comphelper::SolarMutex::m_aMutex
protected

Definition at line 71 of file solarmutex.hxx.

Referenced by doAcquire(), doRelease(), and tryToAcquire().

◆ m_nCount

sal_uInt32 comphelper::SolarMutex::m_nCount
protected

Definition at line 72 of file solarmutex.hxx.

Referenced by doAcquire(), doRelease(), and tryToAcquire().

◆ m_nThreadId

std::atomic<std::thread::id> comphelper::SolarMutex::m_nThreadId
private

Definition at line 75 of file solarmutex.hxx.

Referenced by doAcquire(), doRelease(), IsCurrentThread(), and tryToAcquire().


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