From 96e15b8501e5d8fc40c475cbac573f910ab5853b Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 25 Oct 2002 17:05:28 -0300 Subject: threads now are real Lua objects, subject to garbage collection --- ltests.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ltests.h') diff --git a/ltests.h b/ltests.h index 12ad9dcf..885d9235 100644 --- a/ltests.h +++ b/ltests.h @@ -1,5 +1,5 @@ /* -** $Id: ltests.h,v 1.15 2002/07/17 16:25:13 roberto Exp roberto $ +** $Id: ltests.h,v 1.16 2002/10/08 18:45:07 roberto Exp roberto $ ** Internal Header for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -42,10 +42,11 @@ void *debug_realloc (void *block, size_t oldsize, size_t size); /* test for lock/unlock */ extern int islocked; -#define LUA_USERSTATE int *lock; -#define lua_userstateopen(l) if (l != NULL) *cast(int **, l) = &islocked; -#define lua_lock(L) lua_assert((**cast(int **, L))++ == 0) -#define lua_unlock(L) lua_assert(--(**cast(int **, L)) == 0) +#define LUA_USERSTATE int * +#define getlock(l) (*(cast(int **, l) - 1)) +#define lua_userstateopen(l) if (l != NULL) getlock(l) = &islocked; +#define lua_lock(l) lua_assert((*getlock(l))++ == 0) +#define lua_unlock(l) lua_assert(--(*getlock(l)) == 0) int luaB_opentests (lua_State *L); -- cgit v1.2.3-55-g6feb