34 lines
465 B
C++
34 lines
465 B
C++
#include "stdafx.h"
|
|
#include <WBANetwork/Common.h>
|
|
#include <WBANetwork/util/Mutex.h>
|
|
|
|
namespace WBANetwork
|
|
{
|
|
|
|
Mutex::Mutex()
|
|
{
|
|
::InitializeCriticalSection( &m_cs );
|
|
}
|
|
|
|
Mutex::~Mutex()
|
|
{
|
|
::DeleteCriticalSection( &m_cs );
|
|
}
|
|
|
|
bool Mutex::TryLock()
|
|
{
|
|
// return ( TryEnterCriticalSection( &m_cs ) == TRUE );
|
|
return FALSE;
|
|
}
|
|
|
|
void Mutex::Lock()
|
|
{
|
|
::EnterCriticalSection( &m_cs );
|
|
}
|
|
|
|
void Mutex::Unlock()
|
|
{
|
|
::LeaveCriticalSection( &m_cs );
|
|
}
|
|
}
|