diff options
Diffstat (limited to 'ltests.h')
-rw-r--r-- | ltests.h | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.h,v 2.14 2005/05/03 19:01:17 roberto Exp roberto $ | 2 | ** $Id: ltests.h,v 2.15 2005/06/06 13:30:25 roberto Exp roberto $ |
3 | ** Internal Header for Debugging of the Lua Implementation | 3 | ** Internal Header for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -55,16 +55,19 @@ int lua_checkpc (lua_State *L, pCallInfo ci); | |||
55 | 55 | ||
56 | /* test for lock/unlock */ | 56 | /* test for lock/unlock */ |
57 | #undef luai_userstateopen | 57 | #undef luai_userstateopen |
58 | #undef luai_userstatethread | ||
58 | #undef lua_lock | 59 | #undef lua_lock |
59 | #undef lua_unlock | 60 | #undef lua_unlock |
60 | #undef LUAI_EXTRASPACE | 61 | #undef LUAI_EXTRASPACE |
61 | 62 | ||
62 | LUAI_DATA int islocked; | 63 | struct L_EXTRA { int lock; int *plock; }; |
63 | #define LUAI_EXTRASPACE sizeof(double) | 64 | #define LUAI_EXTRASPACE sizeof(struct L_EXTRA) |
64 | #define getlock(l) (*(cast(int **, l) - 1)) | 65 | #define getlock(l) (cast(struct L_EXTRA *, l) - 1) |
65 | #define luai_userstateopen(l) getlock(l) = &islocked; | 66 | #define luai_userstateopen(l) \ |
66 | #define lua_lock(l) lua_assert((*getlock(l))++ == 0) | 67 | (getlock(l)->lock = 0, getlock(l)->plock = &(getlock(l)->lock)) |
67 | #define lua_unlock(l) lua_assert(--(*getlock(l)) == 0) | 68 | #define luai_userstatethread(l,l1) (getlock(l1)->plock = getlock(l)->plock) |
69 | #define lua_lock(l) lua_assert((*getlock(l)->plock)++ == 0) | ||
70 | #define lua_unlock(l) lua_assert(--(*getlock(l)->plock) == 0) | ||
68 | 71 | ||
69 | 72 | ||
70 | int luaB_opentests (lua_State *L); | 73 | int luaB_opentests (lua_State *L); |