This commit is contained in:
boccioli_m
2015-09-02 10:43:04 +02:00
parent 79e9aac763
commit 45202c5b09
748 changed files with 54734 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
#Running scripts in parallel
run("Motor Test 3 100ms")
ret = parallelize((run,("Motor Test 3 100ms")), (run,("Motor Test 3 200ms")))
print ret
#Simple parallization
def task1():
return 1
def task2():
return 2
def task3():
time.sleep(0.1)
return 3
ret = parallelize(task1, task2, task3)
print ret
#Fork amd join
ret = fork(task1, task2, task3)
time.sleep(0.1)
ret = join(ret)
print ret
#Functions with parameters
def devRead(dev, msg):
print msg
return "OK"
ret = parallelize((devRead,(1,"1")), (devRead,(2,"2")), (devRead,(3,"3")))
print ret
#Exception in parallel task
def taskExcept(msg):
raise Exception ("Error in parallel task " + msg)
ret = parallelize((taskExcept,("1")), (taskExcept,("2")) )
print ret