summaryrefslogtreecommitdiff
path: root/gr-blocks/python
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2016-06-25 10:07:53 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2016-06-25 10:07:53 -0700
commitf93f2ef3d80cd217a3a995470a51b9ff8df02978 (patch)
tree322577c37a6bd7418fb9c9b20752ef005926b1af /gr-blocks/python
parentd56f675a9911e0b31a8284a418ddb451b99f8ae5 (diff)
parenta99f8ac8cc9a15ab608081c10a7733fce125e276 (diff)
Merge branch 'maint'
Diffstat (limited to 'gr-blocks/python')
-rwxr-xr-xgr-blocks/python/blocks/qa_hier_block2.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/gr-blocks/python/blocks/qa_hier_block2.py b/gr-blocks/python/blocks/qa_hier_block2.py
index 97206a248d..3e780806bc 100755
--- a/gr-blocks/python/blocks/qa_hier_block2.py
+++ b/gr-blocks/python/blocks/qa_hier_block2.py
@@ -2,6 +2,7 @@
from gnuradio import gr, gr_unittest, blocks
import numpy
+import threading
import time
class add_ff(gr.sync_block):
@@ -427,7 +428,7 @@ class test_hier_block2(gr_unittest.TestCase):
procs = hblock.processor_affinity()
self.assertEquals((0,), procs)
- def test_lock_unlock(self):
+ def test_34a_lock_unlock(self):
hblock = gr.top_block("test_block")
src = blocks.null_source(gr.sizeof_float)
throttle = blocks.throttle(gr.sizeof_float, 32000)
@@ -442,5 +443,28 @@ class test_hier_block2(gr_unittest.TestCase):
hblock.stop()
hblock.wait()
+ def test_34b_lock_unlock(self):
+ hblock = gr.top_block("test_block")
+ src = blocks.null_source(gr.sizeof_float)
+ throttle = blocks.throttle(gr.sizeof_float, 32000)
+ sink = blocks.null_sink(gr.sizeof_float)
+ hblock.connect(src, throttle, sink)
+ hblock.set_processor_affinity([0,])
+ def thread_01(hblock, cls):
+ cls.test_34b_val = 10
+ hblock.lock()
+ cls.test_34b_val = 20
+ hblock.unlock()
+ cls.test_34b_val = 30
+ time.sleep(0.5)
+ cls.test_34b_val = 40
+ hblock.stop()
+ hblock.start()
+ self.test_34b_val = 0
+ t1 = threading.Thread(target=thread_01, args=(hblock, self, ))
+ t1.start()
+ hblock.wait()
+ self.assertEqual(40, self.test_34b_val)
+
if __name__ == "__main__":
gr_unittest.run(test_hier_block2, "test_hier_block2.xml")