From 13944b37c971df72c79f6b1d08e8ad835399f047 Mon Sep 17 00:00:00 2001 From: mgronlun Date: Wed, 13 Feb 2013 11:23:46 +0100 Subject: [PATCH] 8007312: null check signal semaphore in os::signal_notify windows Reviewed-by: dholmes, sla --- src/os/windows/vm/os_windows.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/os/windows/vm/os_windows.cpp b/src/os/windows/vm/os_windows.cpp index eb16478ab..b1556bf64 100644 --- a/src/os/windows/vm/os_windows.cpp +++ b/src/os/windows/vm/os_windows.cpp @@ -1940,7 +1940,7 @@ int os::sigexitnum_pd(){ // a counter for each possible signal value, including signal_thread exit signal static volatile jint pending_signals[NSIG+1] = { 0 }; -static HANDLE sig_sem; +static HANDLE sig_sem = NULL; void os::signal_init_pd() { // Initialize signal structures @@ -1970,10 +1970,11 @@ void os::signal_init_pd() { void os::signal_notify(int signal_number) { BOOL ret; - - Atomic::inc(&pending_signals[signal_number]); - ret = ::ReleaseSemaphore(sig_sem, 1, NULL); - assert(ret != 0, "ReleaseSemaphore() failed"); + if (sig_sem != NULL) { + Atomic::inc(&pending_signals[signal_number]); + ret = ::ReleaseSemaphore(sig_sem, 1, NULL); + assert(ret != 0, "ReleaseSemaphore() failed"); + } } static int check_pending_signals(bool wait_for_signal) { -- GitLab