From bb91f035a17e258490a75e47997fa98527394ba4 Mon Sep 17 00:00:00 2001 From: Jonas Echterhoff Date: Fri, 27 Jul 2018 18:11:03 +0300 Subject: [PATCH] New API to stop and start the GC world externally (part of commits 39e14be, 05e3377 from Unity-Technologies/bdwgc) Issue #173 (bdwgc). * include/gc.h (GC_stop_world_external, GC_start_world_external): Declare new API function. * misc.c (GC_stop_world_external, GC_start_world_external): Implement. --- include/gc.h | 3 +++ misc.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/gc.h b/include/gc.h index 1c5308e..0a4ee50 100644 --- a/include/gc.h +++ b/include/gc.h @@ -2042,6 +2042,9 @@ GC_API void GC_CALL GC_win32_free_heap(void); (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic_ignore_off_page) #endif /* _AMIGA && !GC_AMIGA_MAKINGLIB */ +GC_API void GC_CALL GC_stop_world_external(void); +GC_API void GC_CALL GC_start_world_external(void); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/misc.c b/misc.c index 2ae2606..a597a0a 100644 --- a/misc.c +++ b/misc.c @@ -2528,3 +2528,15 @@ GC_API void GC_CALL GC_abort_on_oom(void) GC_err_printf("Insufficient memory for the allocation\n"); EXIT(); } + +GC_API void GC_CALL GC_stop_world_external(void) +{ + LOCK(); + STOP_WORLD(); +} + +GC_API void GC_CALL GC_start_world_external(void) +{ + START_WORLD(); + UNLOCK(); +} -- 2.7.4