/* Used as a counter, so that nested enabling */
/* and disabling work correctly. Should */
/* normally be updated with GC_enable() and */
- /* GC_disable() calls. */
- /* Direct assignment to GC_dont_gc is */
- /* deprecated. */
+ /* GC_disable() calls. Direct assignment to */
+ /* GC_dont_gc is deprecated. To check whether */
+ /* GC is disabled, GC_is_disabled() is */
+ /* preferred for new code. */
GC_API int GC_dont_expand;
/* Don't expand the heap unless explicitly */
/* ineffective. */
GC_API void GC_CALL GC_disable(void);
+/* Return non-zero (TRUE) if and only if garbage collection is disabled */
+/* (i.e., GC_dont_gc value is non-zero). Does not acquire the lock. */
+GC_API int GC_CALL GC_is_disabled(void);
+
/* Re-enable garbage collection. GC_disable() and GC_enable() calls */
/* nest. Garbage collection is enabled if the number of calls to both */
/* both functions is equal. */
UNLOCK();
}
+GC_API int GC_CALL GC_is_disabled(void)
+{
+ return GC_dont_gc != 0;
+}
+
/* Helper procedures for new kind creation. */
GC_API void ** GC_CALL GC_new_free_list_inner(void)
{