LibreOffice LibreOffice 4.1 SDK C/C++ API Reference

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
osl::Mutex Class Reference

A mutual exclusion synchronization object. More...

`#include <mutex.hxx>`

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

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

## Detailed Description

A mutual exclusion synchronization object.

## Constructor & Destructor Documentation

osl::Mutex::Mutex | ( |  | ) |
| inline

Create a thread-local mutex.

Returns
  0 if the mutex could not be created, otherwise a handle to the mutex.

See Also
  osl_createMutex()

osl::Mutex::~Mutex | ( |  | ) |
| inline

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

See Also
  osl_destroyMutex()

## Member Function Documentation

sal_Bool osl::Mutex::acquire | ( |  | ) |
| inline

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

Returns
  sal_False if system-call fails.

See Also
  osl_acquireMutex()

static Mutex* osl::Mutex::getGlobalMutex | ( |  | ) |
| inline static

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()

sal_Bool osl::Mutex::release | ( |  | ) |
| inline

Release the mutex.

Returns
  sal_False if system-call fails.

See Also
  osl_releaseMutex()

sal_Bool osl::Mutex::tryToAcquire | ( |  | ) |
| inline

Try to acquire the mutex without blocking.

Returns
  sal_False if it could not be acquired.

See Also
  osl_tryToAcquireMutex()

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

- osl/mutex.hxx