LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
Public Member Functions | Static Public Member Functions | Friends | List of all members
osl::Mutex Class Reference

A mutual exclusion synchronization object. More...

#include <mutex.hxx>

Public Member Functions

 Mutex ()
 Create a mutex. More...
 
 ~Mutex ()
 Release the OS-structures and free mutex data-structure. More...
 
bool acquire ()
 Acquire the mutex, block if already acquired by another thread. More...
 
bool tryToAcquire ()
 Try to acquire the mutex without blocking. More...
 
bool release ()
 Release the mutex. More...
 

Static Public Member Functions

static MutexgetGlobalMutex ()
 Returns a global static mutex object. More...
 

Friends

oslMutexosl_getGlobalMutex ()
 Returns a unique and global mutex. More...
 

Detailed Description

A mutual exclusion synchronization object.

Constructor & Destructor Documentation

◆ Mutex()

osl::Mutex::Mutex ( )
inline

Create a mutex.

The mutex value is 0 if it could not be created, otherwise a handle to the mutex.

See also
osl_createMutex()

◆ ~Mutex()

osl::Mutex::~Mutex ( )
inline

Release the OS-structures and free mutex data-structure.

See also
osl_destroyMutex()

Member Function Documentation

◆ acquire()

bool osl::Mutex::acquire ( )
inline

Acquire the mutex, block if already acquired by another thread.

Returns
false if system-call fails.
See also
osl_acquireMutex()

◆ getGlobalMutex()

static Mutex* osl::Mutex::getGlobalMutex ( )
inlinestatic

Returns a global static mutex object.

The global and static mutex object can be used to initialize other static objects in a thread safe manner.

Returns
the global mutex object
See also
osl_getGlobalMutex()

◆ release()

bool osl::Mutex::release ( )
inline

Release the mutex.

Returns
false if system-call fails.
See also
osl_releaseMutex()

◆ tryToAcquire()

bool osl::Mutex::tryToAcquire ( )
inline

Try to acquire the mutex without blocking.

Returns
false if it could not be acquired.
See also
osl_tryToAcquireMutex()

Friends And Related Function Documentation

◆ osl_getGlobalMutex

oslMutex* osl_getGlobalMutex ( )
friend

Returns a unique and global mutex.

Returns
the global mutex.

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