Mercurial > hg > graal-jvmci-8
comparison src/os/windows/vm/os_windows.cpp @ 14704:b51e29501f30
Merged with jdk9/dev/hotspot changeset 9486a41de3b7
author | twisti |
---|---|
date | Tue, 18 Mar 2014 20:19:10 -0700 |
parents | d8041d695d19 f6301b007a16 |
children | 92aa6797d639 |
comparison
equal
deleted
inserted
replaced
14647:8f483e200405 | 14704:b51e29501f30 |
---|---|
3630 bool os::is_interrupted(Thread* thread, bool clear_interrupted) { | 3630 bool os::is_interrupted(Thread* thread, bool clear_interrupted) { |
3631 assert(!thread->is_Java_thread() || Thread::current() == thread || Threads_lock->owned_by_self(), | 3631 assert(!thread->is_Java_thread() || Thread::current() == thread || Threads_lock->owned_by_self(), |
3632 "possibility of dangling Thread pointer"); | 3632 "possibility of dangling Thread pointer"); |
3633 | 3633 |
3634 OSThread* osthread = thread->osthread(); | 3634 OSThread* osthread = thread->osthread(); |
3635 bool interrupted = osthread->interrupted(); | |
3636 // There is no synchronization between the setting of the interrupt | 3635 // There is no synchronization between the setting of the interrupt |
3637 // and it being cleared here. It is critical - see 6535709 - that | 3636 // and it being cleared here. It is critical - see 6535709 - that |
3638 // we only clear the interrupt state, and reset the interrupt event, | 3637 // we only clear the interrupt state, and reset the interrupt event, |
3639 // if we are going to report that we were indeed interrupted - else | 3638 // if we are going to report that we were indeed interrupted - else |
3640 // an interrupt can be "lost", leading to spurious wakeups or lost wakeups | 3639 // an interrupt can be "lost", leading to spurious wakeups or lost wakeups |
3641 // depending on the timing | 3640 // depending on the timing. By checking thread interrupt event to see |
3641 // if the thread gets real interrupt thus prevent spurious wakeup. | |
3642 bool interrupted = osthread->interrupted() && (WaitForSingleObject(osthread->interrupt_event(), 0) == WAIT_OBJECT_0); | |
3642 if (interrupted && clear_interrupted) { | 3643 if (interrupted && clear_interrupted) { |
3643 osthread->set_interrupted(false); | 3644 osthread->set_interrupted(false); |
3644 ResetEvent(osthread->interrupt_event()); | 3645 ResetEvent(osthread->interrupt_event()); |
3645 } // Otherwise leave the interrupted state alone | 3646 } // Otherwise leave the interrupted state alone |
3646 | 3647 |