Skip to content

Commit

Permalink
BUG: Fix crash when exiting the daemon thread (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
codingl2k1 authored Nov 29, 2024
1 parent b1fd262 commit 0f28fe7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/xoscar/backends/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from __future__ import annotations

import asyncio
import atexit
import copy
import logging
import threading
Expand Down Expand Up @@ -216,6 +217,7 @@ class _RefHolder:
_close_loop = asyncio.new_event_loop()
_close_thread = threading.Thread(target=_close_loop.run_forever, daemon=True)
_close_thread.start()
atexit.register(_close_loop.call_soon_threadsafe, _close_loop.stop)

def __init__(self):
self._thread_local = threading.local()
Expand Down

0 comments on commit 0f28fe7

Please sign in to comment.