aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-02 13:13:05 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-02 13:13:05 -0200
commit426d3e43bdec4b1ab2b0aed1844396c27f64872f (patch)
tree659b73e1e9720fb85c66a481b476c96671eef734 /lgc.c
parent8823f371a2a63f634121a0c16cb1d02e5ce9f5c5 (diff)
downloadlua-426d3e43bdec4b1ab2b0aed1844396c27f64872f.tar.gz
lua-426d3e43bdec4b1ab2b0aed1844396c27f64872f.tar.bz2
lua-426d3e43bdec4b1ab2b0aed1844396c27f64872f.zip
lock/unlock may use L + better structure for internal debug stuff
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/lgc.c b/lgc.c
index 90c8165a..d980d8e8 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.83 2001/01/29 19:34:02 roberto Exp roberto $ 2** $Id: lgc.c,v 1.84 2001/02/01 17:40:48 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -17,6 +17,19 @@
17#include "ltm.h" 17#include "ltm.h"
18 18
19 19
20/*
21** optional "lock" for GC
22** (when Lua calls GC tag methods it unlocks the regular lock)
23*/
24#ifndef LUA_LOCKGC
25#define LUA_LOCKGC(L) {
26#endif
27
28#ifndef LUA_UNLOCKGC
29#define LUA_UNLOCKGC(L) }
30#endif
31
32
20typedef struct GCState { 33typedef struct GCState {
21 Hash *tmark; /* list of marked tables to be visited */ 34 Hash *tmark; /* list of marked tables to be visited */
22 Closure *cmark; /* list of marked closures to be visited */ 35 Closure *cmark; /* list of marked closures to be visited */
@@ -351,12 +364,14 @@ static void callgcTMudata (lua_State *L) {
351 364
352 365
353void luaC_collect (lua_State *L, int all) { 366void luaC_collect (lua_State *L, int all) {
367 LUA_LOCKGC(L);
354 collectudata(L, all); 368 collectudata(L, all);
355 callgcTMudata(L); 369 callgcTMudata(L);
356 collectstrings(L, all); 370 collectstrings(L, all);
357 collecttable(L); 371 collecttable(L);
358 collectproto(L); 372 collectproto(L);
359 collectclosure(L); 373 collectclosure(L);
374 LUA_UNLOCKGC(L);
360} 375}
361 376
362 377