From 6c835afcfbb74a26b84bc717102f4772db649cc4 Mon Sep 17 00:00:00 2001 From: hboehm Date: Sun, 24 Feb 2008 20:25:02 +0000 Subject: 2008-02-24 Hans Boehm * win32_threads.c (GC_delete_gc_thread, GC_delete_thread): Consistently call CloseHandle. (GC_suspend): Call GC_delete_gc_thread. * tests/test.c: Don't reference GC_print_stats if not exported. --- ChangeLog | 7 +++++++ tests/test.c | 4 ++++ win32_threads.c | 7 ++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65163989..980809b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-02-24 Hans Boehm + + * win32_threads.c (GC_delete_gc_thread, GC_delete_thread): + Consistently call CloseHandle. (GC_suspend): Call + GC_delete_gc_thread. + * tests/test.c: Don't reference GC_print_stats if not exported. + 2008-02-20 Hans Boehm * tests/test.c (run_one_test): Don't mention pthread_self(). diff --git a/tests/test.c b/tests/test.c index 059eb10f..60335414 100644 --- a/tests/test.c +++ b/tests/test.c @@ -43,6 +43,10 @@ # if defined(MSWIN32) || defined(MSWINCE) # include +# ifdef GC_DLL +# define GC_print_stats 0 /* Not exported from DLL */ + /* Redefine to 1 to generate output. */ +# endif # endif # ifdef PCR diff --git a/win32_threads.c b/win32_threads.c index d5ca89f0..272af63a 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -488,12 +488,12 @@ static GC_thread GC_lookup_thread(DWORD thread_id) /* thread being deleted. */ void GC_delete_gc_thread(GC_vthread gc_id) { + CloseHandle(gc_id->handle); if (GC_win32_dll_threads) { /* This is intended to be lock-free. */ /* It is either called synchronously from the thread being deleted, */ /* or by the joining thread. */ /* In this branch asynchronosu changes to *gc_id are possible. */ - CloseHandle(gc_id->handle); gc_id -> stack_base = 0; gc_id -> id = 0; # ifdef CYGWIN32 @@ -551,6 +551,7 @@ void GC_delete_thread(DWORD id) prev = p; p = p -> next; } + CloseHandle(p->handle); if (prev == 0) { GC_threads[hv] = p -> next; } else { @@ -705,8 +706,8 @@ void GC_suspend(GC_thread t) # ifndef GC_PTHREADS /* this breaks pthread_join on Cygwin, which is guaranteed to */ /* only see user pthreads */ - AO_store(&(t -> in_use), FALSE); - CloseHandle(t -> handle); + GC_ASSERT(GC_win32_dll_threads); + GC_delete_gc_thread(t); # endif return; } -- cgit v1.2.1