--- a/src/hotspot/os/windows/os_windows.cpp Tue Sep 17 09:20:59 2019 -0700
+++ b/src/hotspot/os/windows/os_windows.cpp Tue Sep 17 19:09:37 2019 -0400
@@ -612,7 +612,9 @@
return false;
}
osthread->set_interrupt_event(interrupt_event);
- osthread->set_interrupted(false);
+ // We don't call set_interrupted(false) as it will trip the assert in there
+ // as we are not operating on the current thread. We don't need to call it
+ // because the initial state is already correct.
thread->set_osthread(osthread);
@@ -684,7 +686,6 @@
if (thread_handle == NULL) {
// Need to clean up stuff we've allocated so far
- CloseHandle(osthread->interrupt_event());
thread->set_osthread(NULL);
delete osthread;
return false;
@@ -714,7 +715,6 @@
"os::free_thread but not current thread");
CloseHandle(osthread->thread_handle());
- CloseHandle(osthread->interrupt_event());
delete osthread;
}
@@ -3485,7 +3485,6 @@
}
-
// Short sleep, direct OS call.
//
// ms = 0, means allow others (if any) to run.
@@ -3593,49 +3592,6 @@
return OS_OK;
}
-void os::interrupt(Thread* thread) {
- debug_only(Thread::check_for_dangling_thread_pointer(thread);)
- assert(thread->is_Java_thread(), "invariant");
- JavaThread* jt = (JavaThread*) thread;
- OSThread* osthread = thread->osthread();
- osthread->set_interrupted(true);
- // More than one thread can get here with the same value of osthread,
- // resulting in multiple notifications. We do, however, want the store
- // to interrupted() to be visible to other threads before we post
- // the interrupt event.
- OrderAccess::release();
- SetEvent(osthread->interrupt_event());
- // For JSR166: unpark after setting status
- jt->parker()->unpark();
-
- ParkEvent * ev = thread->_ParkEvent;
- if (ev != NULL) ev->unpark();
-
- ev = jt->_SleepEvent;
- if (ev != NULL) ev->unpark();
-}
-
-
-bool os::is_interrupted(Thread* thread, bool clear_interrupted) {
- debug_only(Thread::check_for_dangling_thread_pointer(thread);)
-
- OSThread* osthread = thread->osthread();
- // There is no synchronization between the setting of the interrupt
- // and it being cleared here. It is critical - see 6535709 - that
- // we only clear the interrupt state, and reset the interrupt event,
- // if we are going to report that we were indeed interrupted - else
- // an interrupt can be "lost", leading to spurious wakeups or lost wakeups
- // depending on the timing. By checking thread interrupt event to see
- // if the thread gets real interrupt thus prevent spurious wakeup.
- bool interrupted = osthread->interrupted() && (WaitForSingleObject(osthread->interrupt_event(), 0) == WAIT_OBJECT_0);
- if (interrupted && clear_interrupted) {
- osthread->set_interrupted(false);
- ResetEvent(osthread->interrupt_event());
- } // Otherwise leave the interrupted state alone
-
- return interrupted;
-}
-
// GetCurrentThreadId() returns DWORD
intx os::current_thread_id() { return GetCurrentThreadId(); }
@@ -5346,7 +5302,7 @@
JavaThread* thread = JavaThread::current();
// Don't wait if interrupted or already triggered
- if (Thread::is_interrupted(thread, false) ||
+ if (thread->is_interrupted(false) ||
WaitForSingleObject(_ParkEvent, 0) == WAIT_OBJECT_0) {
ResetEvent(_ParkEvent);
return;