diff options
Diffstat (limited to 'xml/test')
-rw-r--r-- | xml/test/props.xml | 6 | ||||
-rw-r--r-- | xml/test/test_prop2.py | 3 | ||||
-rw-r--r-- | xml/test/test_prop4.py (renamed from xml/test/test_prop_mt.py) | 14 |
3 files changed, 9 insertions, 14 deletions
diff --git a/xml/test/props.xml b/xml/test/props.xml index dc08cbe..750881d 100644 --- a/xml/test/props.xml +++ b/xml/test/props.xml @@ -3,9 +3,5 @@ <transform path="/test/prop1" register="test_prop1" unit="C" read_from_register="(503975./1024000)*${/registers/fpga/sensor_temperature:C} - 27315./100" description="formula to get real fpga temperature from the fpga_temperature register in decimal"/> <transform path="/test/prop2" register="test_prop2" unit="C" script="test_prop2.py" description="test python script #1" write_verification="0" /> <transform path="/test/prop3" register="test_prop3" unit="C" script="test_prop3.py" description="test python script #2" /> - <transform path="/test/prop_mt" - register="test_prop_mt" - unit="C" - script="test_prop_mt.py" - description="Example of thread safe python property"/> + <transform path="/test/prop4" register="test_prop4" unit="C" script="test_prop4.py" description="Example of thread safe python property"/> </model> diff --git a/xml/test/test_prop2.py b/xml/test/test_prop2.py index d78dbea..8a3ebf6 100644 --- a/xml/test/test_prop2.py +++ b/xml/test/test_prop2.py @@ -1,6 +1,5 @@ def read_from_register(ctx, value): return ctx.get_property('/test/prop3') / 2 - + def write_to_register(ctx, value): ctx.set_property(value*2, '/test/prop3') - diff --git a/xml/test/test_prop_mt.py b/xml/test/test_prop4.py index 224a80c..a7e0269 100644 --- a/xml/test/test_prop_mt.py +++ b/xml/test/test_prop4.py @@ -4,21 +4,21 @@ lock = threading.Lock() def read_from_register(ctx, value): with lock: - ctx.lock('lock12') - + ctx.lock('test_prop4') + cur = read_from_register.counter read_from_register.counter += 1 for i in range (0, 5): time.sleep(0.1) print(cur) out = ctx.get_property('/test/prop3') / 2 - ctx.unlock('lock12') - + + ctx.unlock('test_prop4') + return out - - + read_from_register.counter = 0 - + def write_to_register(ctx, value): with lock: ctx.set_property(value*2, '/test/prop3') |