--- old/src/os/windows/vm/os_windows.cpp Tue Feb 25 17:39:24 2014 +++ new/src/os/windows/vm/os_windows.cpp Tue Feb 25 17:39:23 2014 @@ -3613,13 +3613,14 @@ "possibility of dangling Thread pointer"); OSThread* osthread = thread->osthread(); - bool interrupted = osthread->interrupted(); // 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 + // 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()); --- old/src/share/vm/opto/library_call.cpp Tue Feb 25 17:39:24 2014 +++ new/src/share/vm/opto/library_call.cpp Tue Feb 25 17:39:24 2014 @@ -3236,7 +3236,8 @@ // private native boolean java.lang.Thread.isInterrupted(boolean ClearInterrupted); bool LibraryCallKit::inline_native_isInterrupted() { // Add a fast path to t.isInterrupted(clear_int): - // (t == Thread.current() && (!TLS._osthread._interrupted || !clear_int)) + // (t == Thread.current() && + // (!TLS._osthread._interrupted || WINDOWS_ONLY(false) NOT_WINDOWS(!clear_int))) // ? TLS._osthread._interrupted : /*slow path:*/ t.isInterrupted(clear_int) // So, in the common case that the interrupt bit is false, // we avoid making a call into the VM. Even if the interrupt bit @@ -3299,6 +3300,12 @@ Node* bol_arg = _gvn.transform(new (C) BoolNode(cmp_arg, BoolTest::ne)); IfNode* iff_arg = create_and_map_if(control(), bol_arg, PROB_FAIR, COUNT_UNKNOWN); +#ifdef TARGET_OS_FAMILY_windows + // To return true on Windows you must read the _interrupted field + // and check the the event state i.e. take the slow path. + result_rgn->init_req(no_clear_result_path, top()); + result_val->init_req(no_clear_result_path, top()); +#else // Second fast path: ... else if (!clear_int) return true; Node* false_arg = _gvn.transform(new (C) IfFalseNode(iff_arg)); result_rgn->init_req(no_clear_result_path, false_arg); @@ -3310,6 +3317,7 @@ // (d) Otherwise, go to the slow path. slow_region->add_req(control()); set_control( _gvn.transform(slow_region)); +#endif if (stopped()) { // There is no slow path.