на реализацию - она выглядит следующим образом:
                  
                  
                  
                  
                  
                  bool os::is_interrupted(Thread* thread, bool clear_interrupted) {
                  
                  
                    assert(!thread->is_Java_thread() || Thread::current() == thread || Threads_lock->owned_by_self(), "possibility of dangling Thread pointer");
                  
                  
                  
                  
                  
                    OSThread* osthread = thread->osthread();
                  
                  
                    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;
                  
                  
                  }
                  
                  
                  
                  
                  
                  а OSThread::interrupted так:
                  
                  
                  class OSThread: public CHeapObj<mtThread> {
                  
                  
                    ...
                  
                  
                    volatile jint _interrupted;     // Thread.isInterrupted state
                  
                  
                    ...
                  
                  
                    volatile bool interrupted() const                 { return _interrupted != 0; }
                  
                  
                    void set_interrupted(bool z)                      { _interrupted = z ? 1 : 0; }
                  
                  
                  }
                  
                  
                
@HotSpotIntrinsicCandidate намекает на то, что на деле в горячем коде будет совсем другое
Обсуждают сегодня