code: def thread_wrapped_func(func):
      """
      Wraps a process entry point to make it work with OpenMP.
      """
  
      @wraps(func)
      def decorated_function(*args, **kwargs):
          queue = mp.Queue()
  
          def _queue_result():
              exception, trace, res = None, None, None
              try:
                  res = func(*args, **kwargs)
              except Exception as e:  # pylint: disable=broad-except
                  exception = e
                  trace = traceback.format_exc()
              queue.put((res, exception, trace))
  
          start_new_thread(_queue_result, ())
          result, exception, trace = queue.get()
          if exception is None:
              return result
          else:
              assert isinstance(exception, Exception)
              raise exception.__class__(trace)
  
      return decorated_function
  
file_path: dgl/python/dgl/multiprocessing/pytorch.py
imports: import random
  import traceback
  from _thread import start_new_thread
  from functools import wraps
  import torch
  import torch.multiprocessing
  from ..utils import create_shared_mem_array, get_shared_mem_array
label_desc: Use image node_id 1 for calling a global function with example usage: thread_wrapped_func(func) and returns: decorated_function, result