Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- from simple_pipe import *
- ppc1 = ProcessPairController()
- ppc2 = ProcessPairController()
- def p1():
- wait_turn = GeneratePPCExchange.send_oscillate(ppc1, ppc2)
- for i in range(10):
- wait_turn()
- print('Process AAA iteration', i)
- def p2():
- wait_turn = GeneratePPCExchange.receive_oscillate(ppc1, ppc2)
- for i in range(10):
- wait_turn()
- print('Process BBB iteration', i)
- thread1 = Process(target = p1, name = "Process AAA")
- thread2 = Process(target = p2, name = "Process BBB")
- thread1.start()
- thread2.start()
- thread1.join()
- thread2.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement