# interrupt method

void interrupt({

1. int priority = Isolate.immediate,

})

Forcefully terminates the underlying Isolate.

This is the equivalent of Java's `Thread.interrupt()`, but due to Dart's isolate nature, it forcefully kills the isolate using `Isolate.kill()`.

Optional `priority` allows setting the urgency of the termination.

If the thread was not completed, the ThreadInterruptedException is thrown.

Example:

    thread.interrupt();

## Implementation

    void interrupt({int priority = Isolate.immediate}) {
      if (_isolate != null) {
        _isolate!.kill(priority: priority);
        _activeThreads.remove(_isolate); // Unregister
        _isolate = null;
        _receivePort?.close();
        if (!(_joinCompleter?.isCompleted ?? false)) {
          _joinCompleter?.completeError(ThreadInterruptedException('Isolate $_debugName was interrupted.'));
        }
      }
    }