diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-10-25 17:05:28 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-10-25 17:05:28 -0300 |
commit | 96e15b8501e5d8fc40c475cbac573f910ab5853b (patch) | |
tree | 2c8efededa6849704f0db3075d0cbe0efaa40b2d /ltests.h | |
parent | 0fd91b1b087b478fffa36f96bc0f608d86627a4b (diff) | |
download | lua-96e15b8501e5d8fc40c475cbac573f910ab5853b.tar.gz lua-96e15b8501e5d8fc40c475cbac573f910ab5853b.tar.bz2 lua-96e15b8501e5d8fc40c475cbac573f910ab5853b.zip |
threads now are real Lua objects, subject to garbage collection
Diffstat (limited to 'ltests.h')
-rw-r--r-- | ltests.h | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.h,v 1.15 2002/07/17 16:25:13 roberto Exp roberto $ | 2 | ** $Id: ltests.h,v 1.16 2002/10/08 18:45:07 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 | */ |
@@ -42,10 +42,11 @@ void *debug_realloc (void *block, size_t oldsize, size_t size); | |||
42 | 42 | ||
43 | /* test for lock/unlock */ | 43 | /* test for lock/unlock */ |
44 | extern int islocked; | 44 | extern int islocked; |
45 | #define LUA_USERSTATE int *lock; | 45 | #define LUA_USERSTATE int * |
46 | #define lua_userstateopen(l) if (l != NULL) *cast(int **, l) = &islocked; | 46 | #define getlock(l) (*(cast(int **, l) - 1)) |
47 | #define lua_lock(L) lua_assert((**cast(int **, L))++ == 0) | 47 | #define lua_userstateopen(l) if (l != NULL) getlock(l) = &islocked; |
48 | #define lua_unlock(L) lua_assert(--(**cast(int **, L)) == 0) | 48 | #define lua_lock(l) lua_assert((*getlock(l))++ == 0) |
49 | #define lua_unlock(l) lua_assert(--(*getlock(l)) == 0) | ||
49 | 50 | ||
50 | 51 | ||
51 | int luaB_opentests (lua_State *L); | 52 | int luaB_opentests (lua_State *L); |