lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
Classes | Typedefs | Functions
lean::concurrent Namespace Reference

Defines classes and utilities for multi-threaded environments such as spin locks, atomic operations, etc. More...

Classes

class  critical_section
 Implements a light-weight reentrant binary lock. More...
class  event
 Implements an event. More...
class  semaphore
 Implements a semaphore. More...
struct  shared_lock_policy
 Shared locking policy. More...
struct  upgrade_lock_policy
 Shared lock upgrade locking policy. More...
class  shareable_spin_lock
 Implements a shareable spin lock that is NOT reentrant. More...
class  spin_lock
 Implements a simple binary spin lock that is NOT reentrant. More...
class  thread
 Manages a simple thread. More...

Typedefs

typedef smart::scoped_lock
< critical_section
scoped_cs_lock
 Scoped critical section lock.
typedef smart::scoped_lock
< shareable_spin_lock<> > 
scoped_ssl_lock
 Scoped exclusive sharable spin lock.
typedef smart::scoped_lock
< shareable_spin_lock
<>, shared_lock_policy
< shareable_spin_lock<> > > 
scoped_ssl_lock_shared
 Scoped shared sharable spin lock.
typedef smart::scoped_lock
< shareable_spin_lock
<>, upgrade_lock_policy
< shareable_spin_lock<> > > 
scoped_ssl_upgrade_lock
 Scoped sharable spin lock upgrade.
typedef smart::scoped_lock
< spin_lock<> > 
scoped_sl_lock
 Scoped exclusive spin lock.

Functions

template<class Integer >
LEAN_INLINE Integer atomic_increment (volatile Integer &value)
 Atomically increments the given value, returning the results.
template<class Integer >
LEAN_INLINE Integer atomic_decrement (volatile Integer &value)
 Atomically decrements the given value, returning the results.
template<class Integer >
LEAN_INLINE bool atomic_test_and_set (volatile Integer &value, typename identity< Integer >::type expectedValue, typename identity< Integer >::type newValue)
 Atomically tests if the given value is equal to the given expected value, assigning the given new value on success.
template<class Integer >
LEAN_INLINE Integer atomic_set (volatile Integer &value, typename identity< Integer >::type newValue)
 Atomically sets the given value.
template<class Pointer >
LEAN_INLINE bool atomic_test_and_set (Pointer *volatile &value, typename identity< Pointer >::type *expectedValue, typename identity< Pointer >::type *newValue)
 Atomically tests if the given value is equal to the given expected value, assigning the given new value on success.
template<class Pointer >
LEAN_INLINE Pointer * atomic_set (Pointer *volatile &value, typename identity< Pointer >::type *newValue)
 Atomically sets the given value.

Detailed Description

Defines classes and utilities for multi-threaded environments such as spin locks, atomic operations, etc.