[M] Change in osmo-ttcn3-hacks[master]: library: add generic Mutex API for parallel components
Attention is currently required from: pespin. fixeria has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38206?usp=email ) Change subject: library: add generic Mutex API for parallel components ...................................................................... Patch Set 2: (1 comment) File library/Mutex.ttcn: https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38206/comment/d67cec94_c356c... : PS2, Line 19: port MutexPT LOCK; /* port for LOCKing the mutex */
What's the point in having 2 ports instead of 1? Sounds way more complex than it should by doing so, […] The point is that multiple parallel components are sending `MUTEX_LOCK` requests and they're getting queued. When the `f_MutexDisp_main()` handles one of those requests, it expects to receive `MUTEX_UNLOCK`, which (if we were to use a single port) will end up somewhere in the queue (behind `MUTEX_LOCK` requests from other components). TTCN-3 does not allow to look up inside the queue, so I had to use two ports: one for locking and the other for unlocking.
Below is a mscgen graph visually explaining the problem, which can be rendered by https://mscgen.js.org/ for instance: ``` msc{ ConnHdlrA, ConnHdlrB, ConnHdlrC, MutexDisp; ConnHdlrB => MutexDisp [label="MUTEX_LOCK.req"]; ConnHdlrA => MutexDisp [label="MUTEX_LOCK.req"]; ConnHdlrC => MutexDisp [label="MUTEX_LOCK.req"]; ConnHdlrA box MutexDisp [label="ConnHdlrB was quicker, so it gets the mutex first"]; ConnHdlrB <= MutexDisp [label="MUTEX_LOCK.cnf"]; ...; ConnHdlrB => MutexDisp [label="MUTEX_UNLOCK.ind"]; ConnHdlrA box MutexDisp [label="MutexDisp still has two MUTEX_LOCK.req in the queue and the MUTEX_UNLOCK.ind is not on top"]; } ``` -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38206?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Id71f43bd5fc78d4bb4417d6c01fcff8112ea6032 Gerrit-Change-Number: 38206 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge@osmocom.org> Gerrit-CC: pespin <pespin@sysmocom.de> Gerrit-Attention: pespin <pespin@sysmocom.de> Gerrit-Comment-Date: Fri, 20 Sep 2024 12:58:02 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin@sysmocom.de>
participants (1)
-
fixeria