fork(3) download
  1. import threading
  2. import time
  3.  
  4. def target():
  5. try:
  6. time.sleep(3)
  7. finally:
  8. print('Doing important cleanup')
  9.  
  10. t = threading.Thread(target=target)
  11. t.daemon=True
  12. t.start()
  13.  
  14. print('Oops, no cleanup.')
Success #stdin #stdout 0.04s 9896KB
stdin
Standard input is empty
stdout
Oops, no cleanup.