summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-05-14 23:30:21 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-05-14 23:30:21 +0300
commitcd465f79c52aa887d2b65a1b26447179def228b6 (patch)
treeedbdfbd60ef32a030428827276c3c6c82f7ee407
parent5f6df10a9317385b77d52ee2006f435639e87e44 (diff)
downloadbdwgc-cd465f79c52aa887d2b65a1b26447179def228b6.tar.gz
Fix GC_unregister_my_thread call before GC functions usage
(fix of commit d7e3062a0) * tests/gctest.c [THREADS] (check_heap_stats): Do not call GC_unregister_my_thread(). * tests/gctest.c [GC_WIN32_THREADS && !GC_PTHREADS] (main): Call GC_unregister_my_thread() just before return. * tests/gctest.c [GC_PTHREADS && !PTW32_STATIC_LIB] (main): Likewise. * tests/gctest.c [GC_PTHREADS && !GC_NO_DLOPEN && !DARWIN && !GC_WIN32_THREADS] (main): Add comment for GC_dlopen argument.
-rw-r--r--tests/gctest.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/gctest.c b/tests/gctest.c
index 48265b04..6882c921 100644
--- a/tests/gctest.c
+++ b/tests/gctest.c
@@ -2120,10 +2120,6 @@ void check_heap_stats(void)
(void)GC_get_size_map_at(1);
# endif
-# ifdef THREADS
- (void)GC_unregister_my_thread(); /* just to check it works (for main) */
-# endif
-
# ifndef NO_CLOCK
GC_printf("Full/world-stopped collections took %lu/%lu ms\n",
GC_get_full_gc_total_time(), GC_get_stopped_mark_total_time());
@@ -2488,6 +2484,7 @@ DWORD __stdcall thr_window(void *arg)
# endif
run_single_threaded_test();
check_heap_stats();
+ (void)GC_unregister_my_thread(); /* just to check it works (for main) */
return 0;
}
@@ -2717,7 +2714,7 @@ int main(void)
# if !defined(GC_NO_DLOPEN) && !defined(DARWIN) \
&& !defined(GC_WIN32_THREADS)
{
- void *h = GC_dlopen("libc.so", 0);
+ void *h = GC_dlopen("libc.so", 0 /* some value (maybe invalid) */);
if (h != NULL) dlclose(h);
}
# endif
@@ -2742,6 +2739,8 @@ int main(void)
# ifdef PTW32_STATIC_LIB
pthread_win32_thread_detach_np();
pthread_win32_process_detach_np();
+# else
+ (void)GC_unregister_my_thread();
# endif
return 0;
}