Skip to content

Instantly share code, notes, and snippets.

@martinohanlon
Created October 27, 2017 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinohanlon/0f7b82393a68482deda056af2672bb9e to your computer and use it in GitHub Desktop.
Save martinohanlon/0f7b82393a68482deda056af2672bb9e to your computer and use it in GitHub Desktop.
Python function Threading examples
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