Re: Exceptions in IPC::Open2
[p5sagit/p5-mst-13.2.git] / XSLock.h
1 #ifndef __XSLock_h__
2 #define __XSLock_h__
3
4 class XSLockManager
5 {
6 public:
7         XSLockManager() { InitializeCriticalSection(&cs); };
8         ~XSLockManager() { DeleteCriticalSection(&cs); };
9         void Enter(void) { EnterCriticalSection(&cs); };
10         void Leave(void) { LeaveCriticalSection(&cs); };
11 protected:
12         CRITICAL_SECTION cs;
13 };
14
15 XSLockManager g_XSLock;
16
17 class XSLock
18 {
19 public:
20         XSLock() { g_XSLock.Enter(); };
21         ~XSLock() { g_XSLock.Leave(); };
22 };
23
24 CPerlObj* 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