libMesh
Public Member Functions | Private Attributes | List of all members
libMesh::Threads::atomic< T > Class Template Reference

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

#include <threads_none.h>

Inheritance diagram for libMesh::Threads::atomic< T >:
[legend]

Public Member Functions

 atomic ()
 
 operator T & ()
 
 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)
 

Private Attributes

_val
 
val
 
spin_mutex smutex
 

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.

Definition at line 172 of file threads_none.h.

Constructor & Destructor Documentation

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

Definition at line 175 of file threads_none.h.

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

Definition at line 479 of file threads_pthread.h.

Member Function Documentation

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

Definition at line 480 of file threads_pthread.h.

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

Definition at line 176 of file threads_none.h.

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

Definition at line 511 of file threads_pthread.h.

512  {
513  spin_mutex::scoped_lock lock(smutex);
514  val++;
515  return val;
516  }
template<typename T>
T libMesh::Threads::atomic< T >::operator++ ( int  )

Definition at line 518 of file threads_pthread.h.

519  {
520  spin_mutex::scoped_lock lock(smutex);
521  val++;
522  return val;
523  }
template<typename T>
T libMesh::Threads::atomic< T >::operator+= ( value)

Definition at line 497 of file threads_pthread.h.

498  {
499  spin_mutex::scoped_lock lock(smutex);
500  val += value;
501  return val;
502  }
static const bool value
Definition: xdr_io.C:108
template<typename T>
T libMesh::Threads::atomic< T >::operator-- ( )

Definition at line 525 of file threads_pthread.h.

526  {
527  spin_mutex::scoped_lock lock(smutex);
528  val--;
529  return val;
530  }
template<typename T>
T libMesh::Threads::atomic< T >::operator-- ( int  )

Definition at line 532 of file threads_pthread.h.

533  {
534  spin_mutex::scoped_lock lock(smutex);
535  val--;
536  return val;
537  }
template<typename T>
T libMesh::Threads::atomic< T >::operator-= ( value)

Definition at line 504 of file threads_pthread.h.

505  {
506  spin_mutex::scoped_lock lock(smutex);
507  val -= value;
508  return val;
509  }
static const bool value
Definition: xdr_io.C:108
template<typename T>
T libMesh::Threads::atomic< T >::operator= ( value)

Definition at line 482 of file threads_pthread.h.

483  {
484  spin_mutex::scoped_lock lock(smutex);
485  val = value;
486  return val;
487  }
static const bool value
Definition: xdr_io.C:108
template<typename T>
atomic<T>& libMesh::Threads::atomic< T >::operator= ( const atomic< T > &  value)

Definition at line 489 of file threads_pthread.h.

490  {
491  spin_mutex::scoped_lock lock(smutex);
492  val = value;
493  return *this;
494  }
static const bool value
Definition: xdr_io.C:108

Member Data Documentation

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

Definition at line 178 of file threads_none.h.

template<typename T>
spin_mutex libMesh::Threads::atomic< T >::smutex
private

Definition at line 541 of file threads_pthread.h.

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

Definition at line 540 of file threads_pthread.h.


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