Created
November 14, 2015 12:25
-
-
Save jszakmeister/ceab35209ac601ab2c45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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