mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-22 11:17:19 +00:00
36 lines
612 B
C++
36 lines
612 B
C++
#ifndef __XSlock_h__
|
|
#define __XSlock_h__
|
|
|
|
class XSLockManager
|
|
{
|
|
public:
|
|
XSLockManager() { InitializeCriticalSection(&cs); };
|
|
~XSLockManager() { DeleteCriticalSection(&cs); };
|
|
void Enter(void) { EnterCriticalSection(&cs); };
|
|
void Leave(void) { LeaveCriticalSection(&cs); };
|
|
protected:
|
|
CRITICAL_SECTION cs;
|
|
};
|
|
|
|
XSLockManager g_XSLock;
|
|
|
|
class XSLock
|
|
{
|
|
public:
|
|
XSLock() { g_XSLock.Enter(); };
|
|
~XSLock() { g_XSLock.Leave(); };
|
|
};
|
|
|
|
CPerlObj* pPerl;
|
|
|
|
#undef dXSARGS
|
|
#define dXSARGS \
|
|
dSP; dMARK; \
|
|
I32 ax = mark - PL_stack_base + 1; \
|
|
I32 items = sp - mark; \
|
|
XSLock localLock; \
|
|
::pPerl = pPerl
|
|
|
|
|
|
#endif
|