code: def test_thread_safety():
      def f(x):
          return 1
  
      dsk = {"x": (sleep, 0.05), "y": (f, "x")}
  
      L = []
  
      def test_f():
          L.append(get(dsk, "y"))
  
      threads = []
      for _ in range(20):
          t = threading.Thread(target=test_f)
          t.daemon = True
          t.start()
          threads.append(t)
  
      for thread in threads:
          thread.join()
  
      assert L == [1] * 20
  
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 12 for calling a global function with example usage: test_thread_safety() and returns: int