Guest User

Untitled

a guest
Feb 11th, 2022
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. import time
  2. import threading
  3.  
  4. event = threading.Event()
  5.  
  6. def target():
  7.     event.wait()
  8.     print('thread done')
  9.  
  10. t = threading.Thread(target=target)
  11. t.start()
  12. print('joining now')
  13. try:
  14.     t.join()
  15. except KeyboardInterrupt:
  16.     pass
  17. print(t.is_alive())
  18. event.set()
Advertisement
Add Comment
Please, Sign In to add comment