Interface TruffleSafepoint.Interrupter

Enclosing class:
TruffleSafepoint

public static interface TruffleSafepoint.Interrupter
An interrupter allows a foreign thread to interrupt the execution on a separate thread. Used to allow the Truffle safepoint mechanism to interrupt a blocked thread and schedule a safepoint.
Since:
21.1
See Also:
  • Field Details

    • THREAD_INTERRUPT

      static final TruffleSafepoint.Interrupter THREAD_INTERRUPT
      A thread interrupter implementation that uses Thread.interrupt() and Thread.interrupted() to clear the thread state.

       THREAD_INTERRUPT = new Interrupter() {
      
           @Override
           public void interrupt(Thread t) {
               t.interrupt();
           }
      
           @Override
           public void interrupted() {
               Thread.interrupted();
           }
      
       };
       
      Since:
      21.1
  • Method Details

    • interrupt

      void interrupt(Thread thread)
      Sets the interrupted state on a foreign thread. Internal locks are held while this method is invoked, therefore this method must not block or run complex or guest language code that could cause deadlocks.
      Parameters:
      thread - the thread to interrupt
      Since:
      21.1
    • resetInterrupted

      void resetInterrupted()
      Resets the interrupted state when executing on a thread after the thread was interrupted. If a thread was interrupted it is guaranteed to be reset at least once, but might be reset multiple times. Internal locks are held while this method is invoked, therefore this method must not block or run complex or guest language code that could cause deadlocks.
      Since:
      21.1