Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input_queue = mp.Queue()
- output_queue = mp.Queue()
- ep = EventProcessor(input_queue, output_queue, name='EventProcessor')
- ep.start()
- ep.request_halt() # sets Event for all threads of the process, such that infinite loop terminates on the next iteration
- ep.join()
- input_queue = mp.Queue()
- output_queue = mp.Queue()
- new_ep = EventProcessor(input_queue, output_queue, name='EventProcessor')
- new_ep.start()
- new_ep.request_halt()
- new_ep.join() # at this point it blocks forever
- def run(self):
- """Launches execution of the process"""
- try:
- print('before threads start')
- for thread in self._threads:
- thread.start()
- print('threads started')
- for thread in self._threads:
- thread.join() # when the launched second time it blocks here forever
- print('threads joined')
- finally:
- self._close_closables() # closes associated queues
- print('leaving the process')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement