MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

Data Structures | Functions | Variables
DatabaseLock.hxx File Reference

Support for locking data structures from the database, for safe multi-threading. More...

`#include "check.h"`
`#include "thread/Mutex.hxx"`
`#include "Compiler.h"`
`#include <assert.h>`
`#include "thread/Id.hxx"`
Include dependency graph for DatabaseLock.hxx:

Go to the source code of this file.

## Data Structures
class | ScopeDatabaseLock
class | ScopeDatabaseUnlock
| Unlock the database while in the current scope. More...

## Functions
static gcc_pure bool | holding_db_lock (void)
| Does the current thread hold the database lock? More...
static void | db_lock (void)
| Obtain the global database lock. More...
static void | db_unlock (void)
| Release the global database lock. More...

## Variables
Mutex | db_mutex
ThreadId | db_mutex_holder

## Detailed Description

Support for locking data structures from the database, for safe multi-threading.

Definition in file DatabaseLock.hxx.

## Function Documentation

static void db_lock | ( | void |  | ) |
| inline static

Obtain the global database lock.

This is needed before dereferencing a #song or #directory. It is not recursive.

Definition at line 60 of file DatabaseLock.hxx.

static void db_unlock | ( | void |  | ) |
| inline static

Release the global database lock.

Definition at line 76 of file DatabaseLock.hxx.

static gcc_pure bool holding_db_lock | ( | void |  | ) |
| inline static

Does the current thread hold the database lock?

Definition at line 48 of file DatabaseLock.hxx.

## Variable Documentation

Mutex db_mutex

ThreadId db_mutex_holder