LibreOffice: osl::Mutex Class Reference

LibreOffice LibreOffice 7.6 SDK C/C++ API Reference

Loading...
Searching...
No Matches
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.
| ~Mutex ()
| Release the OS-structures and free mutex data-structure.
bool | acquire ()
| Acquire the mutex, block if already acquired by another thread.
bool | tryToAcquire ()
| Try to acquire the mutex without blocking.
bool | release ()
| Release the mutex.

## Static Public Member Functions
static Mutex * | getGlobalMutex ()
| Returns a global static mutex object.

## Friends
oslMutex * | osl_getGlobalMutex ()
| Returns a unique and global mutex.

## 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 Symbol 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:

- osl/mutex.hxx