Skip to content

Instantly share code, notes, and snippets.

@jszakmeister
Created November 14, 2015 12:25
Show Gist options
  • Save jszakmeister/ceab35209ac601ab2c45 to your computer and use it in GitHub Desktop.
Save jszakmeister/ceab35209ac601ab2c45 to your computer and use it in GitHub Desktop.
import threading
import time
from datetime import datetime
def foo():
while True:
print datetime.now()
time.sleep(1.0)
t = threading.Thread(target=foo)
t.daemon = True
t.start()
time.sleep(4.)
# We should exit, and the thread will die.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment