From: Ivan Maidanski Date: Wed, 21 Mar 2018 07:26:10 +0000 (+0300) Subject: Fix ASSERT_CANCEL_DISABLED violation in try_to_collect_inner X-Git-Tag: v8.0.0~281 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=46e7ec21e3f8fb67abd8f3d582a32a9b8cdb6873;p=platform%2Fupstream%2Flibgc.git Fix ASSERT_CANCEL_DISABLED violation in try_to_collect_inner (fix of commit b04b346) Issue #182 (bdwgc). * finalize.c (GC_ON_GROW_LOG_SIZE_MIN): Define to CPP_LOG_HBLKSIZE value by default. * finalize.c (GC_grow_table): Surround GC_try_to_collect_inner call with DISABLE/RESTORE_CANCEL. --- diff --git a/finalize.c b/finalize.c index cbe00b8..8c4e380 100644 --- a/finalize.c +++ b/finalize.c @@ -102,7 +102,7 @@ GC_API void GC_CALL GC_push_finalizer_structures(void) /* Threshold of log_size to initiate full collection before growing */ /* a hash table. */ #ifndef GC_ON_GROW_LOG_SIZE_MIN -# define GC_ON_GROW_LOG_SIZE_MIN 12 +# define GC_ON_GROW_LOG_SIZE_MIN CPP_LOG_HBLKSIZE #endif /* Double the size of a hash table. *log_size_ptr is the log of its */ @@ -125,7 +125,11 @@ STATIC void GC_grow_table(struct hash_chain_entry ***table, /* Avoid growing the table in case of at least 25% of entries can */ /* be deleted by enforcing a collection. Ignored for small tables. */ if (log_old_size >= GC_ON_GROW_LOG_SIZE_MIN) { + IF_CANCEL(int cancel_state;) + + DISABLE_CANCEL(cancel_state); (void)GC_try_to_collect_inner(GC_never_stop_func); + RESTORE_CANCEL(cancel_state); /* GC_finalize might decrease entries value. */ if (*entries_ptr < ((word)1 << log_old_size) - (*entries_ptr >> 2)) return;