python thread not exiting with atexit
问题 Here is my script. When I run it in a shell it just hangs indefinitely whereas I would expect it to terminate cleanly. import logging from logging import StreamHandler import pymsteams import queue import threading import atexit class TeamsHandler(StreamHandler): def __init__(self, channel_url): super().__init__() self.channel_url = channel_url self.queue = queue.Queue() self.thread = threading.Thread(target=self._worker) self.thread.start() atexit.register(self.queue.put, None) def _worker