kirr has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmocom-bb/+/40048?usp=email )
Change subject: trx_toolkit/transceiver: Remove _tx_queue_lock
......................................................................
trx_toolkit/transceiver: Remove _tx_queue_lock
After Iaa675c95059ec8ccfad667f69984d5a7f608c249 (trx_toolkit/clck_gen:
Don't use threads because Python GIL is latency killer) fake_trx.py is
single-threaded architecture. There is no need to use mutex when
adding/removing entries to/from TX queue.
Change-Id: I77762564326b370479845a347fc512cb5f643bda
---
M src/target/trx_toolkit/transceiver.py
1 file changed, 12 insertions(+), 23 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/48/40048/1
diff --git a/src/target/trx_toolkit/transceiver.py
b/src/target/trx_toolkit/transceiver.py
index ce71bb1..2ebb29a 100644
--- a/src/target/trx_toolkit/transceiver.py
+++ b/src/target/trx_toolkit/transceiver.py
@@ -19,7 +19,6 @@
# GNU General Public License for more details.
import logging as log
-import threading
from ctrl_if_trx import CTRLInterfaceTRX
from data_if import DATAInterface
@@ -134,7 +133,7 @@
a L12TRX message on the TRXD (data) interface, so it gets queued by
this function. Then, to ensure the timeous transmission, the user
of this implementation needs to call clck_tick() on each TDMA
- frame. Both functions are thread-safe (queue mutex).
+ frame.
In a multi-trx configuration, the use of queue additionally ensures
proper burst aggregation on multiple TRXD connections, so all L12TRX
@@ -193,8 +192,7 @@
# List of child transceivers
self.child_trx_list = TRXList()
- # Tx (L12TRX) burst queue and mutex
- self._tx_queue_lock = threading.Lock()
+ # Tx (L12TRX) burst queue
self._tx_queue = []
def __str__(self):
@@ -256,7 +254,7 @@
for trx in trx_list:
trx.running = poweron
if not poweron:
- trx.tx_queue_clear()
+ trx._tx_queue.clear()
trx.disable_fh()
# Trigger clock generator if required
@@ -289,21 +287,13 @@
return None
# Enqueue the message, it will be sent later
- self.tx_queue_append(msg)
+ self._tx_queue.append(msg)
return msg
def handle_data_msg(self, msg):
# TODO: make legacy mode configurable (via argv?)
self.data_if.send_msg(msg, legacy = True)
- def tx_queue_append(self, msg):
- with self._tx_queue_lock:
- self._tx_queue.append(msg)
-
- def tx_queue_clear(self):
- with self._tx_queue_lock:
- self._tx_queue.clear()
-
def clck_tick(self, fwd, fn):
if not self.running:
return
@@ -312,16 +302,15 @@
emit = []
wait = []
- with self._tx_queue_lock:
- for msg in self._tx_queue:
- if msg.fn < fn:
- drop.append(msg)
- elif msg.fn == fn:
- emit.append(msg)
- else:
- wait.append(msg)
+ for msg in self._tx_queue:
+ if msg.fn < fn:
+ drop.append(msg)
+ elif msg.fn == fn:
+ emit.append(msg)
+ else:
+ wait.append(msg)
- self._tx_queue = wait
+ self._tx_queue = wait
for msg in emit:
fwd.forward_msg(self, msg)
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/40048?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I77762564326b370479845a347fc512cb5f643bda
Gerrit-Change-Number: 40048
Gerrit-PatchSet: 1
Gerrit-Owner: kirr <kirr(a)nexedi.com>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>