code: def test_interrupt():
      # Windows implements `queue.get` using polling,
      # which means we can set an exception to interrupt the call to `get`.
      # Python 3 on other platforms requires sending SIGINT to the main thread.
      if sys.platform == "win32":
          from _thread import interrupt_main
      else:
          main_thread = threading.get_ident()
  
          def interrupt_main() -> None:
              signal.pthread_kill(main_thread, signal.SIGINT)
  
      in_clog_event = threading.Event()
      clog_event = threading.Event()
  
      def clog(
          in_clog_event: threading.Event, clog_event: threading.Event
      ) -> None:
          in_clog_event.set()
          clog_event.wait()
  
      def interrupt(in_clog_event: threading.Event) -> None:
          in_clog_event.wait()
          interrupt_main()
  
      dsk = {
          ("x", i): (clog, in_clog_event, clog_event) for i in range(20)
      }
      dsk["x"] = (len, list(dsk.keys()))
  
      interrupter = threading.Thread(
          target=interrupt, args=(in_clog_event,)
      )
      interrupter.start()
  
      # Use explicitly created ThreadPoolExecutor to avoid leaking threads after
      # the KeyboardInterrupt
      with ThreadPoolExecutor(CPU_COUNT) as pool:
          with pytest.raises(KeyboardInterrupt):
              get(dsk, "x", pool=pool)
          clog_event.set()
      interrupter.join()
  
imports: from __future__ import annotations
  import signal
  import sys
  import threading
  from concurrent.futures import ThreadPoolExecutor
  from multiprocessing.pool import ThreadPool
  from time import sleep, time
  import pytest
  import dask
  from dask.system import CPU_COUNT
  from dask.threaded import get
  from dask.utils_test import add, inc
label_desc: Use image node_id 13 for calling a global function with example usage: test_interrupt() without return types