Back to index

nux  3.0.0
Public Member Functions | Private Attributes
nux::NThreadSafeCounter Class Reference

#include <ThreadGNU.h>

List of all members.

Public Member Functions

 NThreadSafeCounter ()
 NThreadSafeCounter (int i)
int Increment ()
int Decrement ()
int Set (int i)
int GetValue () const
int operator++ ()
int operator-- ()
bool operator== (int i)

Private Attributes

int m_Counter

Detailed Description

Definition at line 36 of file ThreadGNU.h.


Constructor & Destructor Documentation

Definition at line 39 of file ThreadGNU.h.

    {
      m_Counter = 0;
    }

Definition at line 43 of file ThreadGNU.h.

    {
      m_Counter = i;
    }

Member Function Documentation

Definition at line 34 of file ThreadGNU.cpp.

  {
    return __sync_add_and_fetch (&m_Counter, -1);
  }

Here is the caller graph for this function:

Definition at line 44 of file ThreadGNU.cpp.

  {
    return m_Counter;
  }

Here is the caller graph for this function:

Definition at line 29 of file ThreadGNU.cpp.

  {
    return __sync_add_and_fetch (&m_Counter, 1);
  }

Here is the caller graph for this function:

int nux::NThreadSafeCounter::operator++ ( )

Definition at line 49 of file ThreadGNU.cpp.

  {
    return Increment();
  }

Here is the call graph for this function:

int nux::NThreadSafeCounter::operator-- ( )

Definition at line 54 of file ThreadGNU.cpp.

  {
    return Decrement();
  }

Here is the call graph for this function:

bool nux::NThreadSafeCounter::operator== ( int  i)

Definition at line 59 of file ThreadGNU.cpp.

  {
    return (m_Counter == i);
  }

Definition at line 39 of file ThreadGNU.cpp.

  {
    return __sync_lock_test_and_set (&m_Counter, i);
  }

Member Data Documentation

Definition at line 55 of file ThreadGNU.h.


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