fork(1) download
  1. import threading
  2. import time
  3.  
  4. class Sleeper(object):
  5. def __init__(self, sleep_func):
  6. self.sleep = sleep_func
  7.  
  8. def __del__(self):
  9. self.sleep(1)
  10.  
  11. def thread_func():
  12. sleeper = Sleeper(time.sleep)
  13. a = 1
  14. while True:
  15. a += 1
  16.  
  17. thread = threading.Thread(target=thread_func)
  18. thread.setDaemon(True)
  19. thread.start()
  20.  
Runtime error #stdin #stdout 0.04s 18336KB
stdin
Standard input is empty
stdout
Standard output is empty