This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix alignment issues in malloc.c on 64-bit platforms (via private mail)
[perl5.git] / XSLock.h
CommitLineData
565764a8
DL
1#ifndef __XSLock_h__
2#define __XSLock_h__
3
4class XSLockManager
5{
6public:
7 XSLockManager() { InitializeCriticalSection(&cs); };
8 ~XSLockManager() { DeleteCriticalSection(&cs); };
9 void Enter(void) { EnterCriticalSection(&cs); };
10 void Leave(void) { LeaveCriticalSection(&cs); };
11protected:
12 CRITICAL_SECTION cs;
13};
14
15XSLockManager g_XSLock;
16
17class XSLock
18{
19public:
20 XSLock() { g_XSLock.Enter(); };
21 ~XSLock() { g_XSLock.Leave(); };
22};
23
24CPerlObj* pPerl;
25
26#undef dXSARGS
27#define dXSARGS \
28 dSP; dMARK; \
29 I32 ax = mark - stack_base + 1; \
30 I32 items = sp - mark; \
31 XSLock localLock; \
32 ::pPerl = pPerl
33
34
35#endif