$extrastylesheet
libMesh::Threads::atomic< T > Class Template Reference

#include <threads.h>

Inheritance diagram for libMesh::Threads::atomic< T >:

List of all members.

Public Member Functions

 atomic ()
 operator T ()
operator= (T value)
atomic< T > & operator= (const atomic< T > &value)
operator+= (T value)
operator-= (T value)
operator++ ()
operator++ (int)
operator-- ()
operator-- (int)
 atomic ()
 operator T & ()

Private Attributes

val
spin_mutex smutex
_val

Detailed Description

template<typename T>
class libMesh::Threads::atomic< T >

Defines atomic operations which can only be executed on a single thread at a time. This is used in reference counting, for example, to allow count++/count-- to work.

Defines atomic operations which can only be executed on a single thread at a time.

Definition at line 324 of file threads.h.


Constructor & Destructor Documentation

template<typename T>
libMesh::Threads::atomic< T >::atomic ( ) [inline]

Definition at line 716 of file threads.h.

: val(0) {}
template<typename T>
libMesh::Threads::atomic< T >::atomic ( ) [inline]

Definition at line 906 of file threads.h.

: _val(0) {}

Member Function Documentation

template<typename T>
libMesh::Threads::atomic< T >::operator T ( ) [inline]

Definition at line 717 of file threads.h.

{ return val; }
template<typename T>
libMesh::Threads::atomic< T >::operator T & ( ) [inline]

Definition at line 907 of file threads.h.

{ return _val; }
template<typename T>
T libMesh::Threads::atomic< T >::operator++ ( ) [inline]

Definition at line 748 of file threads.h.

  {
    spin_mutex::scoped_lock lock(smutex);
    val++;
    return val;
  }
template<typename T>
T libMesh::Threads::atomic< T >::operator++ ( int  ) [inline]

Definition at line 755 of file threads.h.

  {
    spin_mutex::scoped_lock lock(smutex);
    val++;
    return val;
  }
template<typename T>
T libMesh::Threads::atomic< T >::operator+= ( value) [inline]

Definition at line 734 of file threads.h.

  {
    spin_mutex::scoped_lock lock(smutex);
    val += value;
    return val;
  }
template<typename T>
T libMesh::Threads::atomic< T >::operator-- ( ) [inline]

Definition at line 762 of file threads.h.

  {
    spin_mutex::scoped_lock lock(smutex);
    val--;
    return val;
  }
template<typename T>
T libMesh::Threads::atomic< T >::operator-- ( int  ) [inline]

Definition at line 769 of file threads.h.

  {
    spin_mutex::scoped_lock lock(smutex);
    val--;
    return val;
  }
template<typename T>
T libMesh::Threads::atomic< T >::operator-= ( value) [inline]

Definition at line 741 of file threads.h.

  {
    spin_mutex::scoped_lock lock(smutex);
    val -= value;
    return val;
  }
template<typename T>
T libMesh::Threads::atomic< T >::operator= ( value) [inline]

Definition at line 719 of file threads.h.

  {
    spin_mutex::scoped_lock lock(smutex);
    val = value;
    return val;
  }
template<typename T>
atomic<T>& libMesh::Threads::atomic< T >::operator= ( const atomic< T > &  value) [inline]

Definition at line 726 of file threads.h.

  {
    spin_mutex::scoped_lock lock(smutex);
    val = value;
    return *this;
  }

Member Data Documentation

template<typename T>
T libMesh::Threads::atomic< T >::_val [private]

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