class_docstr: helper for monkey-patching the signal-handler of uvicorn
class_docstr_tok: ["helper","for","monkey-patching","the","signal-handler","of","uvicorn"]
docstr: signal handler for uvicorn server
  :param args: args
  :param kwargs: kwargs
docstr_tok: ["signal","handler","for","uvicorn","server",":","param","args",":","args",":","param","kwargs",":","kwargs"]
code: def handle_exit(*args, **kwargs):
      """
      signal handler for uvicorn server
      :param args: args
      :param kwargs: kwargs
      """
      # set bool flag before checking the event to avoid race condition
      AppStatus.should_exit = True
      # Check if event has been initialized, if so notify listeners
      if AppStatus.should_exit_event is not None:
          AppStatus.should_exit_event.set()
      original_handler(*args, **kwargs)
  
imports: import enum
  import io
  import json
  import logging
  import re
  from datetime import datetime
  from functools import partial
  from typing import Any, AsyncIterable, Callable, Coroutine, Dict, Optional, Union
  import anyio
  from starlette.background import BackgroundTask
  from starlette.concurrency import iterate_in_threadpool
  from starlette.responses import Response
  from starlette.types import Receive, Scope, Send
label_desc: Use image node_id 1 for calling the AppStatus obj's underlying member method code with example usage: obj.handle_exit() without return types