From 426d3e43bdec4b1ab2b0aed1844396c27f64872f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 2 Feb 2001 13:13:05 -0200 Subject: lock/unlock may use L + better structure for internal debug stuff --- lgc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'lgc.c') diff --git a/lgc.c b/lgc.c index 90c8165a..d980d8e8 100644 --- a/lgc.c +++ b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 1.83 2001/01/29 19:34:02 roberto Exp roberto $ +** $Id: lgc.c,v 1.84 2001/02/01 17:40:48 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -17,6 +17,19 @@ #include "ltm.h" +/* +** optional "lock" for GC +** (when Lua calls GC tag methods it unlocks the regular lock) +*/ +#ifndef LUA_LOCKGC +#define LUA_LOCKGC(L) { +#endif + +#ifndef LUA_UNLOCKGC +#define LUA_UNLOCKGC(L) } +#endif + + typedef struct GCState { Hash *tmark; /* list of marked tables to be visited */ Closure *cmark; /* list of marked closures to be visited */ @@ -351,12 +364,14 @@ static void callgcTMudata (lua_State *L) { void luaC_collect (lua_State *L, int all) { + LUA_LOCKGC(L); collectudata(L, all); callgcTMudata(L); collectstrings(L, all); collecttable(L); collectproto(L); collectclosure(L); + LUA_UNLOCKGC(L); } -- cgit v1.2.3-55-g6feb