Skip to content

Instantly share code, notes, and snippets.

@njsmith
Created February 22, 2017 09:26
Show Gist options
  • Select an option

  • Save njsmith/58e81cc8b6c63fc40aca46e64d33aa9c to your computer and use it in GitHub Desktop.

Select an option

Save njsmith/58e81cc8b6c63fc40aca46e64d33aa9c to your computer and use it in GitHub Desktop.
PARALLEL = False
COUNT = 1000000000
import threading
import time
def count():
n = COUNT
while n > 0:
n -= 1
if PARALLEL:
t1 = threading.Thread(target=count)
t1.start()
t2 = threading.Thread(target=count)
t2.start()
t1.join()
t2.join()
else:
count()
count()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment