library of assembled shared sources

http://lass.cocamware.com

lass::util::ThreadLocalVariable< T > Class Template Reference
[Threading]

A primitive to provide Thread Local Storage functionality for a first-citizen class. More...

#include <thread.h>

Inheritance diagram for lass::util::ThreadLocalVariable< T >:

Inheritance graph
[legend]
Collaboration diagram for lass::util::ThreadLocalVariable< T >:

Collaboration graph
[legend]

Public Types

typedef CallTraits< T >::TValue TValue
typedef CallTraits< T >::TParam TParam
typedef CallTraits< T >
::TConstReference 
TConstReference
typedef CallTraits< T >::TReference TReference

Public Member Functions

 ThreadLocalVariable (TParam prototype=T())
TValue *const get ()
const TValue *const get () const
TValue *const operator-> ()
const TValue *const operator-> () const
TReference operator* ()
TConstReference operator* () const

Private Member Functions

void swap (NonCopyable &)

Static Private Member Functions

static void destructor (void *p)

Private Attributes

TValue prototype_
ThreadLocalStorage storage_

Detailed Description

template<typename T>
class lass::util::ThreadLocalVariable< T >

A primitive to provide Thread Local Storage functionality for a first-citizen class.

Warning:
On Win32 platform, you should _access_ a ThreadLocalVariable inside code running from a util::Thread (or util::threadFun for that matter). This is because the destructor of the variable will _only_ be called on exit of a util::Thread. If you access it from any other thread (even the main thread), the variable will correctly constructed for that thread, but it will _never_ be destructed! On a POSIX platform, this is not a problem though! The destructor will always be called.

Definition at line 256 of file thread.h.


Member Typedef Documentation

template<typename T >
typedef CallTraits<T>::TValue lass::util::ThreadLocalVariable< T >::TValue

Definition at line 259 of file thread.h.

template<typename T >
typedef CallTraits<T>::TParam lass::util::ThreadLocalVariable< T >::TParam

Definition at line 260 of file thread.h.

Definition at line 261 of file thread.h.

template<typename T >
typedef CallTraits<T>::TReference lass::util::ThreadLocalVariable< T >::TReference

Definition at line 262 of file thread.h.


Constructor & Destructor Documentation

template<typename T >
lass::util::ThreadLocalVariable< T >::ThreadLocalVariable ( TParam  prototype = T()  )  [inline, explicit]

Definition at line 264 of file thread.h.


Member Function Documentation

template<typename T >
TValue* const lass::util::ThreadLocalVariable< T >::get (  )  [inline]

Definition at line 270 of file thread.h.

template<typename T >
const TValue* const lass::util::ThreadLocalVariable< T >::get (  )  const [inline]

Definition at line 282 of file thread.h.

template<typename T >
TValue* const lass::util::ThreadLocalVariable< T >::operator-> (  )  [inline]

Definition at line 294 of file thread.h.

template<typename T >
const TValue* const lass::util::ThreadLocalVariable< T >::operator-> (  )  const [inline]

Definition at line 299 of file thread.h.

template<typename T >
TReference lass::util::ThreadLocalVariable< T >::operator* (  )  [inline]

Definition at line 304 of file thread.h.

template<typename T >
TConstReference lass::util::ThreadLocalVariable< T >::operator* (  )  const [inline]

Definition at line 309 of file thread.h.

template<typename T >
static void lass::util::ThreadLocalVariable< T >::destructor ( void *  p  )  [inline, static, private]

Definition at line 316 of file thread.h.

void lass::util::NonCopyable::swap ( NonCopyable  )  [inline, protected, inherited]

Definition at line 60 of file non_copyable.h.

Referenced by lass::io::Image::readLine().


Field Documentation

template<typename T >
TValue lass::util::ThreadLocalVariable< T >::prototype_ [private]

Definition at line 321 of file thread.h.

Referenced by lass::util::ThreadLocalVariable< Allocator >::get().

template<typename T >
ThreadLocalStorage lass::util::ThreadLocalVariable< T >::storage_ [mutable, private]

Definition at line 322 of file thread.h.

Referenced by lass::util::ThreadLocalVariable< Allocator >::get().


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

Generated on Mon Nov 10 14:22:17 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo