Skip to content

Commit

Permalink
Fix hanging thread (#100)
Browse files Browse the repository at this point in the history
* Create Spout threads as daemon.

* Bump version.

* Use python2 compat daemon flag.
  • Loading branch information
maximelb committed May 1, 2023
1 parent 81921d5 commit 33d5684
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion limacharlie/Spout.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def __init__( self, man, data_type, is_parse = True, max_buffer = 1024, inv_id =
if self._hConn.status_code != 200:
raise LcApiException( 'failed to open Spout (%s): %s' % ( self._hConn.status_code, self._hConn.text ) )
handleConnectionThread = threading.Thread( target = self._handleConnection, args = ( spoutParams, ) )
handleConnectionThread.daemon = True
self._threads.append( handleConnectionThread )
handleConnectionThread.start()
self._futureCleanupInterval = 30
Expand Down Expand Up @@ -247,7 +248,8 @@ def main( sourceArgs = None ):
def _signal_handler( signum, frame ):
_printToStderr( 'You pressed Ctrl+C!' )
sp._isStopStop = True
threading.Thread( target = sp.shutdown() ).start()
hTh = threading.Thread( target = sp.shutdown() ).start()
hTh.daemon = True

signal.signal( signal.SIGINT, _signal_handler )

Expand Down
2 changes: 1 addition & 1 deletion limacharlie/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""limacharlie API for limacharlie.io"""

__version__ = "4.4.5"
__version__ = "4.4.6"
__author__ = "Maxime Lamothe-Brassard ( Refraction Point, Inc )"
__author_email__ = "maxime@refractionpoint.com"
__license__ = "Apache v2"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup

__version__ = "4.4.5"
__version__ = "4.4.6"
__author__ = "Maxime Lamothe-Brassard ( Refraction Point, Inc )"
__author_email__ = "maxime@refractionpoint.com"
__license__ = "Apache v2"
Expand Down

0 comments on commit 33d5684

Please sign in to comment.