-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpy_part2.py
56 lines (45 loc) · 1.5 KB
/
py_part2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import time
import py_cord as reference
import multiprocessing
if __name__ == '__main__':
#SIMULATION1
object = reference.Operations(0,1,0)
process1 = multiprocessing.Process(target=object.sender, args=( ))
process2 = multiprocessing.Process(target=object.receiver, args=())
process2.start()
process1.start()
process1.join(timeout=50)
process2.join(timeout=50)
process1.terminate()
process2.terminate()
#SIMULATION3
object = reference.Operations(0, 2,1)
process1 = multiprocessing.Process(target=object.sender, args=( ))
process2 = multiprocessing.Process(target=object.receiver, args=())
process2.start()
process1.start()
process1.join(timeout=10)
process2.join(timeout=10)
process1.terminate()
process2.terminate()
time.sleep(35)
#SIMULATION3
object = reference.Operations(0, 3, 1)
process1 = multiprocessing.Process(target=object.sender, args=( ))
process2 = multiprocessing.Process(target=object.receiver, args=())
process2.start()
process1.start()
process1.join(timeout=90)
process2.join(timeout=90)
process1.terminate()
process2.terminate()
#SIMULATION4
object = reference.Operations(0, 4, 2)
process1 = multiprocessing.Process(target=object.sender, args=( ))
process2 = multiprocessing.Process(target=object.receiver, args=())
process2.start()
process1.start()
process1.join(timeout=90)
process2.join(timeout=90)
process1.terminate()
process2.terminate()