Created
October 27, 2017 14:24
-
-
Save martinohanlon/0f7b82393a68482deda056af2672bb9e to your computer and use it in GitHub Desktop.
Python function Threading examples
This file contains 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 | |
from time import sleep | |
def count(time_to_sleep): | |
while True: | |
i = 0 | |
print(i) | |
i += 1 | |
sleep(time_to_sleep) | |
t1 = threading.Thread(target = count, args = (1,)) | |
t1.start() | |
t2 = threading.Thread(target = count, args = (2,)) | |
t2.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment