3593 return OS_OK; |
3593 return OS_OK; |
3594 } |
3594 } |
3595 |
3595 |
3596 void os::interrupt(Thread* thread) { |
3596 void os::interrupt(Thread* thread) { |
3597 debug_only(Thread::check_for_dangling_thread_pointer(thread);) |
3597 debug_only(Thread::check_for_dangling_thread_pointer(thread);) |
3598 |
3598 assert(thread->is_Java_thread(), "invariant"); |
|
3599 JavaThread* jt = (JavaThread*) thread; |
3599 OSThread* osthread = thread->osthread(); |
3600 OSThread* osthread = thread->osthread(); |
3600 osthread->set_interrupted(true); |
3601 osthread->set_interrupted(true); |
3601 // More than one thread can get here with the same value of osthread, |
3602 // More than one thread can get here with the same value of osthread, |
3602 // resulting in multiple notifications. We do, however, want the store |
3603 // resulting in multiple notifications. We do, however, want the store |
3603 // to interrupted() to be visible to other threads before we post |
3604 // to interrupted() to be visible to other threads before we post |
3604 // the interrupt event. |
3605 // the interrupt event. |
3605 OrderAccess::release(); |
3606 OrderAccess::release(); |
3606 SetEvent(osthread->interrupt_event()); |
3607 SetEvent(osthread->interrupt_event()); |
3607 // For JSR166: unpark after setting status |
3608 // For JSR166: unpark after setting status |
3608 if (thread->is_Java_thread()) { |
3609 jt->parker()->unpark(); |
3609 ((JavaThread*)thread)->parker()->unpark(); |
|
3610 } |
|
3611 |
3610 |
3612 ParkEvent * ev = thread->_ParkEvent; |
3611 ParkEvent * ev = thread->_ParkEvent; |
3613 if (ev != NULL) ev->unpark(); |
3612 if (ev != NULL) ev->unpark(); |
3614 |
3613 |
3615 ev = thread->_SleepEvent; |
3614 ev = jt->_SleepEvent; |
3616 if (ev != NULL) ev->unpark(); |
3615 if (ev != NULL) ev->unpark(); |
3617 } |
3616 } |
3618 |
3617 |
3619 |
3618 |
3620 bool os::is_interrupted(Thread* thread, bool clear_interrupted) { |
3619 bool os::is_interrupted(Thread* thread, bool clear_interrupted) { |