changeset 15733:5bd5dc5b9bb9

8007312: null check signal semaphore in os::signal_notify windows Reviewed-by: dholmes, sla
author mgronlun
date Wed, 13 Feb 2013 11:23:46 +0100
parents d069aaa14d4c
children 68f78eb98356
files hotspot/src/os/windows/vm/os_windows.cpp
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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) {