# Threading

## Classes

class | Loki::Mutex
class | Loki::SingleThreaded< Host, MutexPolicy >

## Detailed Description

Policies to for the threading model:

- SingleThreaded
- ObjectLevelLockable
- ClassLevelLockable

All classes in Loki have configurable threading model.

The macro LOKI_DEFAULT_THREADING selects the default threading model for certain components of Loki (it affects only default template arguments)

Usage:

To use a specific threading model define

- nothing, single-theading is default
- LOKI_OBJECT_LEVEL_THREADING for object-level-threading
- LOKI_CLASS_LEVEL_THREADING for class-level-threading

Supported platfroms:

- Windows (windows.h)
- POSIX (pthread.h): No recursive mutex support with pthread. This means: calling Lock() on a Loki::Mutex twice from the same thread before unlocking the mutex deadlocks the system. To avoid this redesign your synchronization. See also: http://sourceforge.net/tracker/index.php?func=detail&aid=1516182&group_id=29557&atid=396647