From 3bc600aca376ed27dd4466da362b62b098f7c3ec Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Sat, 3 Oct 2020 11:31:59 +0200 Subject: [PATCH] avoid race condition on stop --- src/presence.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/presence.py b/src/presence.py index 0a7b1a1..4c7e966 100644 --- a/src/presence.py +++ b/src/presence.py @@ -21,6 +21,11 @@ class Presence: self._log(logging.INFO, "Presence stopped") def stop(self): + asyncio.get_running_loop().call_soon_threadsafe( + Presence._do_stop, self + ) + + def _do_stop(self): self._stop = True fifo = -1 try: -- 2.39.5