summaryrefslogtreecommitdiff
path: root/win32_threads.c
diff options
context:
space:
mode:
authorTautvydas Zilys <tautvydas.zilys@gmail.com>2017-07-20 00:53:43 +0300
committerIvan Maidanski <ivmai@mail.ru>2017-07-20 01:05:50 +0300
commit72ba00903f12a1a83359599c08ca50625981f0a3 (patch)
treeae2b728a148edd6d15e1f63df56c428512a9397b /win32_threads.c
parentba53c6d65ce1815eb076de44554c43de0acf591d (diff)
downloadbdwgc-72ba00903f12a1a83359599c08ca50625981f0a3.tar.gz
Public API (GC_deinit) to allow Win32 critical sections deletion
Public GC_deinit allows the clients to avoid a leak of two critical sections on GC shutdown. * include/gc.h (GC_deinit): New public function declaration. * include/private/gc_priv.h [MSWIN32 || MSWINCE] (GC_deinit): Remove. * misc.c (GC_deinit): Make it public; define it unconditionally; call DeleteCriticalSection(GC_allocate_ml) if GC_is_initialized; set GC_is_initialized to false. DeleteCriticalSection(GC_allocate_ml) * tests/test.c [!GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK] (main): Add UNTESTED(GC_deinit). * win32_threads.c [GC_WINMAIN_REDIRECT && MSWINCE] (WinMain): Do not call DeleteCriticalSection(GC_allocate_ml). * win32_threads.c [!GC_NO_THREADS_DISCOVERY && !GC_PTHREADS] (GC_DllMain): Likewise.
Diffstat (limited to 'win32_threads.c')
-rw-r--r--win32_threads.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/win32_threads.c b/win32_threads.c
index 692b75b6..54fa5d2b 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -2377,7 +2377,6 @@ GC_INNER void GC_get_next_stack(char *start, char *limit,
# ifdef MSWINCE
GC_deinit();
- DeleteCriticalSection(&GC_allocate_ml);
# endif
return (int) exit_code;
}
@@ -2786,7 +2785,6 @@ GC_INNER void GC_thr_init(void)
GC_delete_gc_thread_no_free(&dll_thread_table[i]);
}
GC_deinit();
- DeleteCriticalSection(&GC_allocate_ml);
}
break;
}