Advertisement
Guest User

Daemon thread

a guest
Aug 14th, 2012
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement