Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
88
Server/GashServer/Sync.h
Normal file
88
Server/GashServer/Sync.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Windows <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
|
||||
|
||||
namespace Nave { namespace Sync {
|
||||
/*
|
||||
class CTest : public CMTSync<CTest>
|
||||
{
|
||||
public:
|
||||
void Test()
|
||||
{
|
||||
CTSync Sync;
|
||||
}
|
||||
};
|
||||
*/
|
||||
class CSync
|
||||
{
|
||||
public:
|
||||
CSync(VOID)
|
||||
{
|
||||
InitializeCriticalSection(&mSync);
|
||||
}
|
||||
|
||||
~CSync(VOID)
|
||||
{
|
||||
DeleteCriticalSection(&mSync);
|
||||
}
|
||||
|
||||
inline VOID Enter(VOID)
|
||||
{
|
||||
EnterCriticalSection(&mSync);
|
||||
}
|
||||
|
||||
inline VOID Leave(VOID)
|
||||
{
|
||||
LeaveCriticalSection(&mSync);
|
||||
}
|
||||
|
||||
private:
|
||||
CRITICAL_SECTION mSync;
|
||||
};
|
||||
|
||||
class CSSync
|
||||
{
|
||||
public:
|
||||
CSSync(LPVOID lpVoid)
|
||||
{
|
||||
m_pThis = (CSync*)lpVoid;
|
||||
m_pThis->Enter();
|
||||
}
|
||||
|
||||
~CSSync(VOID)
|
||||
{
|
||||
if(m_pThis)
|
||||
m_pThis->Leave();
|
||||
}
|
||||
|
||||
protected:
|
||||
CSync *m_pThis;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class CMTSync
|
||||
{
|
||||
friend class CTSync;
|
||||
public:
|
||||
class CTSync
|
||||
{
|
||||
public:
|
||||
CTSync(VOID)
|
||||
{
|
||||
T::mSync.Enter();
|
||||
}
|
||||
|
||||
~CTSync(VOID)
|
||||
{
|
||||
T::mSync.Leave();
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
static CSync mSync;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
CSync CMTSync<T>::mSync;
|
||||
|
||||
}}
|
||||
Reference in New Issue
Block a user