SHARE
TWEET

Daemon thread

a guest Aug 14th, 2012 23 Never
  1. #!/usr/bin/python
  2.  
  3. import threading
  4. import time
  5.  
  6. class Update(threading.Thread):
  7.     def __init__(self):
  8.         threading.Thread.__init__(self)
  9.  
  10.     def run(self):
  11.         while True:
  12.             with open('/tmp/log.txt', 'w') as f:
  13.                 f.write('%d\n' % time.time())
  14.                 time.sleep(1.0)
  15.  
  16. continous = Update()
  17. continous.daemon = True
  18. continous.start()
RAW Paste Data
Top