Merge pull request #2200 from xmcclure/image-audit-oops
[mono.git] / mono / metadata / mono-hash.c
index 63a6b680c0bb0056c6e70639847ce34886a43aa5..d1685bc3ddaa9c62be6f4d353d74db30fdeda055 100644 (file)
@@ -219,12 +219,13 @@ rehash (MonoGHashTable *hash)
        data.new_size = g_spaced_primes_closest (hash->in_use);
        data.table = mg_new0 (Slot *, data.new_size);
 
-#ifdef USE_COOP_GC
-       /* We cannot be preempted */
-       old_table = do_rehash (&data);
-#else
-       old_table = mono_gc_invoke_with_gc_lock (do_rehash, &data);
-#endif
+       if (!mono_threads_is_coop_enabled ()) {
+               old_table = mono_gc_invoke_with_gc_lock (do_rehash, &data);
+       } else {
+               /* We cannot be preempted */
+               old_table = do_rehash (&data);
+       }
+
        mg_free (old_table);
 }