git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1319 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
33 lines
687 B
C++
33 lines
687 B
C++
#include "SynchronizedCounter.hpp"
|
|
|
|
namespace fail {
|
|
|
|
int SynchronizedCounter::increment()
|
|
{
|
|
// Acquire lock on the queue
|
|
#ifndef __puma
|
|
boost::unique_lock<boost::mutex> lock(m_mutex);
|
|
#endif
|
|
return ++m_counter;
|
|
} // Lock is automatically released here
|
|
|
|
int SynchronizedCounter::decrement()
|
|
{
|
|
// Acquire lock on the queue
|
|
#ifndef __puma
|
|
boost::unique_lock<boost::mutex> lock(m_mutex);
|
|
#endif
|
|
return --m_counter;
|
|
} // Lock is automatically released here
|
|
|
|
int SynchronizedCounter::getValue()
|
|
{
|
|
// Acquire lock on the queue
|
|
#ifndef __puma
|
|
boost::unique_lock<boost::mutex> lock(m_mutex);
|
|
#endif
|
|
return m_counter;
|
|
} // Lock is automatically released here
|
|
|
|
} // end-of-namespace: fail
|