libpsynth 0.2.1
Classes | Namespaces | Defines | Typedefs | Functions
/home/raskolnikov/dev/psynth/trunk/src/psynth/base/threads.hpp File Reference

Time-stamp: <2011-06-13 11:10:35 raskolnikov> More...

#include <cassert>
#include <psynth/base/util.hpp>
#include <mutex>
Include dependency graph for threads.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  psynth::base::try_lock_guard< Mutex >
 try_lock_guard, lock_guard and no_lock_guard provide a way to design policies that are not bases just on object or class locking, but fine-grainedly control wether some internal construct should have exclusion, probabilistic exclusion or no exclusion at all. More...
struct  psynth::base::lock_guard< Mutex >
struct  psynth::base::no_lock_guard< Mutex >
struct  psynth::base::no_lock_guard< Mutex >::guard_type
class  psynth::base::no_threading< T >
struct  psynth::base::no_threading< T >::lock
class  psynth::base::lockable_base< T >
class  psynth::base::object_lockable< T, Mutex >
class  psynth::base::object_lockable< T, Mutex >::lock
class  psynth::base::class_lockable< T, Mutex >
class  psynth::base::class_lockable< T, Mutex >::lock
struct  psynth::base::class_lockable< T, Mutex >::initializer

Namespaces

namespace  psynth
namespace  psynth::base

Defines

#define PSYNTH_DEFAULT_THREADING   psynth::base::default_object_lockable::type
#define PSYNTH_DEFAULT_NONOBJ_THREADING   psynth::base::default_class_lockable::type
#define PSYNTH_DEFAULT_MUTEX   std::recursive_mutex

Typedefs

typedef tpl_bind_snd
< object_lockable,
PSYNTH_DEFAULT_MUTEX > 
psynth::base::default_object_lockable
typedef tpl_bind_snd
< class_lockable,
PSYNTH_DEFAULT_MUTEX > 
psynth::base::default_class_lockable

Functions

template<class Mutex , typename... Args>
std::unique_lock< Mutex > psynth::base::make_unique_lock (Mutex &lock, Args...args)
 Utility to avoid writing too many types when locking mutexes.

Detailed Description

Time-stamp: <2011-06-13 11:10:35 raskolnikov>

Author:
Juan Pedro BolĂ­var Puente <raskolnikov@es.gnu.org>
Date:
Tue Apr 7 11:29:08 2009

This module provides simplified and abstracted threading models that can be used for policy-based designs. It is inspired by Andrei Alexandrescu's implementation at his book Modern C++ Design.

To make the code directly compatible with Boost.Threads we use the Boost mutex interface as threading policy. As such, a MutexPolicy must have the following two methods:

A mutex must also the find, as boost::mutex does, a exception safe RAII wrapper to lock the mutex under the name of:


Define Documentation

#define PSYNTH_DEFAULT_MUTEX   std::recursive_mutex
#define PSYNTH_DEFAULT_NONOBJ_THREADING   psynth::base::default_class_lockable::type
#define PSYNTH_DEFAULT_THREADING   psynth::base::default_object_lockable::type