threads now are real Lua objects, subject to garbage collection

This commit is contained in:
Roberto Ierusalimschy
2002-10-25 17:05:28 -03:00
parent 0fd91b1b08
commit 96e15b8501
12 changed files with 247 additions and 205 deletions

View File

@@ -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);