]> granicus.if.org Git - gc/commitdiff
New API to stop and start the GC world externally
authorJonas Echterhoff <jonas@unity3d.com>
Fri, 27 Jul 2018 15:11:03 +0000 (18:11 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 27 Jul 2018 15:11:03 +0000 (18:11 +0300)
(part of commits 39e14be05e3377 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
misc.c

index 1c5308e4b42c88e78309bb9349aba6fc8d547fb1..0a4ee500dd89b83ccc81de7c0abb734d217a838e 100644 (file)
@@ -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 2ae2606ff694b822a186834b602ddcbdc9333391..a597a0a7db689f29ce8818a79921cbb8c433acc7 100644 (file)
--- 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();
+}