8007312: null check signal semaphore in os::signal_notify windows
authormgronlun
Wed, 13 Feb 2013 11:23:46 +0100
changeset 15733 5bd5dc5b9bb9
parent 15602 d069aaa14d4c
child 15734 68f78eb98356
8007312: null check signal semaphore in os::signal_notify windows Reviewed-by: dholmes, sla
hotspot/src/os/windows/vm/os_windows.cpp
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Tue Feb 12 12:19:28 2013 -0500
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Feb 13 11:23:46 2013 +0100
@@ -1940,7 +1940,7 @@
 
 // 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_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) {