From 0bfc572e51d9035a615ef6e9523f736c9ffa8e57 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 13 Dec 2021 10:41:17 -0300 Subject: Bug: GC is not reentrant As the GC is not reentrant, finalizers should not be able to invoke it. --- lgc.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lgc.h') diff --git a/lgc.h b/lgc.h index 073e2a40..024a4328 100644 --- a/lgc.h +++ b/lgc.h @@ -148,6 +148,15 @@ */ #define isdecGCmodegen(g) (g->gckind == KGC_GEN || g->lastatomic != 0) + +/* +** Control when GC is running: +*/ +#define GCSTPUSR 1 /* bit true when GC stopped by user */ +#define GCSTPGC 2 /* bit true when GC stopped by itself */ +#define gcrunning(g) ((g)->gcstp == 0) + + /* ** Does one step of collection when debt becomes positive. 'pre'/'pos' ** allows some adjustments to be done only when needed. macro -- cgit v1.2.3-55-g6feb