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 <axilira...@gmail.com>
Gerrit-MessageType: newchange

Reply via email to