/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to xml/test/test_prop4.py

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-02 22:36:19 UTC
  • mfrom: (346.1.35 pcitool)
  • Revision ID: csa@suren.me-20160302223619-r1zd62x6kwbyd321
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import time
 
2
import threading
 
3
lock = threading.Lock()
 
4
 
 
5
def read_from_register(ctx, value):
 
6
   with lock:
 
7
      ctx.lock('test_prop4')
 
8
 
 
9
      cur = read_from_register.counter
 
10
      read_from_register.counter += 1
 
11
      for i in range (0, 5):
 
12
         time.sleep(0.1)
 
13
         print(cur)
 
14
      out = ctx.get_property('/test/prop3') / 2
 
15
 
 
16
      ctx.unlock('test_prop4')
 
17
 
 
18
      return out
 
19
 
 
20
read_from_register.counter = 0
 
21
 
 
22
def write_to_register(ctx, value):
 
23
   with lock:
 
24
      ctx.set_property(value*2, '/test/prop3')