CS::Threading::MutexImpl< BaseMutex > Class Template Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

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

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

Public Member Functions
CS::Threading::MutexImpl< BaseMutex > Class Template Reference

General mutex class. More...

`#include <csutil/threading/mutex.h>`

Inheritance diagram for CS::Threading::MutexImpl< BaseMutex >:

List of all members.

## Public Member Functions
bool | Lock ()
| Acquire lock on mutex.
| MutexImpl ()
| Initialize an initially unlocked mutex.
bool | TryLock ()
| Try to acquire lock on mutex.
void | Unlock ()
| Unlock the mutex.
| ~MutexImpl ()
| Destroy mutex.

## Detailed Description

### template<typename BaseMutex>
class CS::Threading::MutexImpl< BaseMutex >

General mutex class.

A mutex is a mutual exclusion object, it stops two threads from having it locked at the same time. A thread can get the lock by calling Lock or TryLock, and release it by calling Unlock.

Users are advised to use the ScopedLock helper class.

Definition at line 55 of file mutex.h.

## Constructor & Destructor Documentation

template<typename BaseMutex>

CS::Threading::MutexImpl< BaseMutex >::MutexImpl | ( |  | ) | `[inline]`

Initialize an initially unlocked mutex.

Definition at line 62 of file mutex.h.

template<typename BaseMutex>

CS::Threading::MutexImpl< BaseMutex >::~MutexImpl | ( |  | ) | `[inline]`

Destroy mutex.

Definition at line 70 of file mutex.h.

## Member Function Documentation

template<typename BaseMutex>

bool CS::Threading::MutexImpl< BaseMutex >::Lock | ( |  | ) | `[inline]`

Acquire lock on mutex.

Will block until lock can be successfully acquired.

Returns:
  true if lock was successfully acquired.

Definition at line 80 of file mutex.h.

template<typename BaseMutex>

bool CS::Threading::MutexImpl< BaseMutex >::TryLock | ( |  | ) | `[inline]`

Try to acquire lock on mutex.

Will return without blocking.

Returns:
  true if lock was successfully acquired.

Definition at line 90 of file mutex.h.

template<typename BaseMutex>

void CS::Threading::MutexImpl< BaseMutex >::Unlock | ( |  | ) | `[inline]`

Unlock the mutex.

Definition at line 98 of file mutex.h.

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

- csutil/threading/mutex.h