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

#include <threads.h>

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

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 323 of file threads.h.

Constructor & Destructor Documentation

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

Definition at line 702 of file threads.h.

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

Definition at line 892 of file threads.h.

892 : _val(0) {}

Member Function Documentation

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

Definition at line 703 of file threads.h.

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

Definition at line 893 of file threads.h.

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

Definition at line 734 of file threads.h.

735  {
736  spin_mutex::scoped_lock lock(smutex);
737  val++;
738  return val;
739  }
template<typename T>
T libMesh::Threads::atomic< T >::operator++ ( int  )
inline

Definition at line 741 of file threads.h.

742  {
743  spin_mutex::scoped_lock lock(smutex);
744  val++;
745  return val;
746  }
template<typename T>
T libMesh::Threads::atomic< T >::operator+= ( value)
inline

Definition at line 720 of file threads.h.

721  {
722  spin_mutex::scoped_lock lock(smutex);
723  val += value;
724  return val;
725  }
template<typename T>
T libMesh::Threads::atomic< T >::operator-- ( )
inline

Definition at line 748 of file threads.h.

749  {
750  spin_mutex::scoped_lock lock(smutex);
751  val--;
752  return val;
753  }
template<typename T>
T libMesh::Threads::atomic< T >::operator-- ( int  )
inline

Definition at line 755 of file threads.h.

756  {
757  spin_mutex::scoped_lock lock(smutex);
758  val--;
759  return val;
760  }
template<typename T>
T libMesh::Threads::atomic< T >::operator-= ( value)
inline

Definition at line 727 of file threads.h.

728  {
729  spin_mutex::scoped_lock lock(smutex);
730  val -= value;
731  return val;
732  }
template<typename T>
T libMesh::Threads::atomic< T >::operator= ( value)
inline

Definition at line 705 of file threads.h.

706  {
707  spin_mutex::scoped_lock lock(smutex);
708  val = value;
709  return val;
710  }
template<typename T>
atomic<T>& libMesh::Threads::atomic< T >::operator= ( const atomic< T > &  value)
inline

Definition at line 712 of file threads.h.

713  {
714  spin_mutex::scoped_lock lock(smutex);
715  val = value;
716  return *this;
717  }

Member Data Documentation

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

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

Site Created By: libMesh Developers
Last modified: February 07 2014 16:58:02 UTC

Hosted By:
SourceForge.net Logo