Skip to content

Commit

Permalink
If stop() is called from the same thread, just set the cancelled flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kosak committed Jan 3, 2024
1 parent 393b228 commit b884ef1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions py/client-ticking/src/pydeephaven_ticking/table_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,12 @@ def stop(self) -> None:
This can happen if the user's callback calls stop()."""

self._cancelled = True
if threading.get_ident() == self._thread.ident:
# We are inside the callback, so just setting the 'cancelled' flag suffices.
return

self._reader.cancel()
if threading.get_ident() != self._thread.ident:
self._thread.join()
self._thread.join()

def _process_data(self):
"""This method continuously runs on a separate thread. It processes incoming Barrage messages, feeds them to
Expand Down

0 comments on commit b884ef1

Please sign in to comment.