def MultithreadedMainSignalHandler(signal_num, cur_stack_frame):
  """Final signal handler for multi-threaded main process."""
  if signal_num == signal.SIGINT:
    if logging.getLogger().isEnabledFor(logging.DEBUG):
      stack_trace = ''.join(traceback.format_list(traceback.extract_stack()))
      err = ('DEBUG: Caught CTRL-C (signal %d) - Exception stack trace:\n'
             '    %s' % (signal_num, re.sub('\\n', '\n    ', stack_trace)))
      try:
        sys.stderr.write(err.encode(UTF8))
      except __HOLE__:
        # Can happen when outputting invalid Unicode filenames.
        sys.stderr.write(err)
    else:
      sys.stderr.write('Caught CTRL-C (signal %d) - exiting\n' % signal_num)

  KillProcess(os.getpid())
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/sig_handling.py/MultithreadedMainSignalHandler