/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: src/sgx/core/threading/atomiclock.cpp

*/

#include "sgx/core/core.hpp"

/**
This is the NULL driver version.

Platform drivers should use mutexes around the lockcount inc/dec methods.
*/
CAtomicLock::CAtomicLock()
{
	m_LockCount = 0;
}

tBOOL
CAtomicLock::inc()
{
	m_LockCount++;
	return TRUE;
}

tBOOL
CAtomicLock::dec()
{
	if (--m_LockCount == 0) {
		return TRUE;
	}

	return FALSE;
}

tUINT32 
CAtomicLock::getCount()
{
	return m_LockCount;
}

