use a common poller thread for modules sharing io

When several poller threads are using the same io, the resposivity
of client requests is reduced, as every thread first finishes
its pending communication requests, before it is the turn of the
request thread. This is solved by using one common poller thread
for all modules sharing the same communicator.

+ fix an issue with overriding a property with a parameter, as
  this is the case for pollperiod (cfg was applied to property
  instead of overriding parameter)
+ separate setFastPoll arguments into flag and fast interval
+ fix missing announceUpdate call when read function fails
+ fix mechanism for triggering polls after an io connection
  reconnected again.

Change-Id: I1115a61fae3de80d18416e61f40b52a0eebb637c
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/28021
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2022-03-28 18:14:06 +02:00
committed by l_samenv
parent d5924567da
commit f6f2dd189b
5 changed files with 153 additions and 113 deletions

View File

@ -69,6 +69,7 @@ class ServerStub:
class DummyMultiEvent(threading.Event):
def get_trigger(self):
def trigger(event=self):
event.set()
sys.exit()
@ -80,8 +81,9 @@ def test_Communicator():
o.earlyInit()
o.initModule()
event = DummyMultiEvent()
o.initModule()
o.startModule(event)
assert event.is_set() # event should be set immediately
assert event.wait(timeout=0.1)
def test_ModuleMagic():
@ -193,8 +195,9 @@ def test_ModuleMagic():
assert updates.pop('o1') == expectedBeforeStart
o1.earlyInit()
event = DummyMultiEvent()
o1.initModule()
o1.startModule(event)
event.wait()
assert event.wait(timeout=0.1)
# should contain polled values
expectedAfterStart = {
'status': (Drivable.Status.IDLE, 'ok'), 'value': 'second',
@ -209,8 +212,9 @@ def test_ModuleMagic():
assert updates.pop('o2') == expectedBeforeStart
o2.earlyInit()
event = DummyMultiEvent()
o2.initModule()
o2.startModule(event)
event.wait()
assert event.wait(timeout=0.1)
# value has changed type, b2 and a1 are written
expectedAfterStart.update(value=0, b2='EMPTY', a1=True)
# ramerk: a1=True: this behaviour is a Porgamming error