summaryrefslogtreecommitdiffstats
path: root/gc.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-12-12 06:58:49 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-12-12 06:58:49 -0800
commit4f0c5f1273cb756b886f3a63930e8aa8698aa5c2 (patch)
tree569784ba2e3fcadca9f19cc6961bb5a12a3ad0f5 /gc.h
parentd05841efc07ad0300dbfe2d3f3d67131434a8e3c (diff)
downloadtxr-4f0c5f1273cb756b886f3a63930e8aa8698aa5c2.tar.gz
txr-4f0c5f1273cb756b886f3a63930e8aa8698aa5c2.tar.bz2
txr-4f0c5f1273cb756b886f3a63930e8aa8698aa5c2.zip
Cancel in-progress gc if handling async signal.
If a signal goes off in the middle of gc that is routed to an async lambda handler, we should cancel gc, so the handler finds the heap in a good state. Of course, the handler must not return in this case, or else the interrupted gc will try to resume. * gc.c (inprogress): New static flag. (gc): Increment and decrement inprogress variable. Abort if re-entered. (gc_inprogress): New function. (unmark): Do not clear FREE flags, only REACHABLE. (gc_cancel): New function. * gc.h (gc_inprogress, gc_cancel): Declared. * signal.c (sig_handler): In the async lambda case, check for an in-progress gc and cancel it.
Diffstat (limited to 'gc.h')
-rw-r--r--gc.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gc.h b/gc.h
index 2d6c5cde..ba065903 100644
--- a/gc.h
+++ b/gc.h
@@ -32,6 +32,7 @@ void protect(val *, ...);
val make_obj(void);
void gc(void);
int gc_state(int);
+int gc_inprogress(void);
void gc_mark(val);
void gc_conservative_mark(val);
void gc_mark_mem(val *low, val *high);
@@ -47,6 +48,7 @@ extern int full_gc;
#endif
void unmark(void);
+void gc_cancel(void);
void gc_hint_func(val *);
void gc_report_copies(val *pvar);
void gc_free_all(void);