lock/unlock may use L + better structure for internal debug stuff

This commit is contained in:
Roberto Ierusalimschy
2001-02-02 13:13:05 -02:00
parent 8823f371a2
commit 426d3e43bd
12 changed files with 213 additions and 224 deletions

17
lgc.c
View File

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