Change in osmocom-bb[master]: trx_toolkit/clck_gen.py: turn CLCKGen's thread into a daemon

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Sat Nov 23 19:25:21 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/16178 )


Change subject: trx_toolkit/clck_gen.py: turn CLCKGen's thread into a daemon
......................................................................

trx_toolkit/clck_gen.py: turn CLCKGen's thread into a daemon

If the main thread crashes, the CLCKGen's thread would never stop.
It would also happen if the main thread terminates without calling
CLCKGen.stop().  Let's prevent this by creating a daemon thread.

Change-Id: I9d41c5baa25fa0a263758414a164c1bded25e04e
---
M src/target/trx_toolkit/clck_gen.py
1 file changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/78/16178/1

diff --git a/src/target/trx_toolkit/clck_gen.py b/src/target/trx_toolkit/clck_gen.py
index 92ca217..a50c985 100755
--- a/src/target/trx_toolkit/clck_gen.py
+++ b/src/target/trx_toolkit/clck_gen.py
@@ -70,6 +70,7 @@
 
 		# Initialize and start a new thread
 		self._thread = threading.Thread(target = self._worker)
+		self._thread.setDaemon(True)
 		self._thread.start()
 
 	def stop(self):
@@ -128,6 +129,9 @@
 		self.clck = CLCKGen([self.link], ind_period = 51)
 		self.clck.start()
 
+		# Block unless we receive a signal
+		self.clck._thread.join()
+
 	def sig_handler(self, signum, frame):
 		log.info("Signal %d received" % signum)
 		if signum == signal.SIGINT:

-- 
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/16178
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I9d41c5baa25fa0a263758414a164c1bded25e04e
Gerrit-Change-Number: 16178
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191123/df3c663a/attachment.htm>


More information about the gerrit-log mailing list