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

#include <threads_none.h>

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

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.

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

◆ atomic() [1/2]

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

Definition at line 175 of file threads_none.h.

◆ atomic() [2/2]

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

Definition at line 492 of file threads_pthread.h.

Member Function Documentation

◆ operator T()

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

Definition at line 493 of file threads_pthread.h.

493 { return val; }

◆ operator T&()

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

Definition at line 176 of file threads_none.h.

176 { return _val; }

◆ operator++() [1/2]

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

Definition at line 524 of file threads_pthread.h.

525  {
526  spin_mutex::scoped_lock lock(smutex);
527  val++;
528  return val;
529  }

◆ operator++() [2/2]

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

Definition at line 531 of file threads_pthread.h.

532  {
533  spin_mutex::scoped_lock lock(smutex);
534  val++;
535  return val;
536  }

◆ operator+=()

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

Definition at line 510 of file threads_pthread.h.

511  {
512  spin_mutex::scoped_lock lock(smutex);
513  val += value;
514  return val;
515  }
static const bool value
Definition: xdr_io.C:109

◆ operator--() [1/2]

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

Definition at line 538 of file threads_pthread.h.

539  {
540  spin_mutex::scoped_lock lock(smutex);
541  val--;
542  return val;
543  }

◆ operator--() [2/2]

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

Definition at line 545 of file threads_pthread.h.

546  {
547  spin_mutex::scoped_lock lock(smutex);
548  val--;
549  return val;
550  }

◆ operator-=()

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

Definition at line 517 of file threads_pthread.h.

518  {
519  spin_mutex::scoped_lock lock(smutex);
520  val -= value;
521  return val;
522  }
static const bool value
Definition: xdr_io.C:109

◆ operator=() [1/2]

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

Definition at line 495 of file threads_pthread.h.

496  {
497  spin_mutex::scoped_lock lock(smutex);
498  val = value;
499  return val;
500  }
static const bool value
Definition: xdr_io.C:109

◆ operator=() [2/2]

template<typename T>
atomic<T>& libMesh::Threads::atomic< T >::operator= ( const atomic< T > &  value)
inline

Definition at line 502 of file threads_pthread.h.

503  {
504  spin_mutex::scoped_lock lock(smutex);
505  val = value;
506  return *this;
507  }
static const bool value
Definition: xdr_io.C:109

Member Data Documentation

◆ _val

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

◆ smutex

◆ val


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