Skip to content

Instantly share code, notes, and snippets.

@teguhteja
Created December 2, 2020 05:02
Show Gist options
  • Save teguhteja/2569d6e822925fcf8ad66fd09ce1a27e to your computer and use it in GitHub Desktop.
Save teguhteja/2569d6e822925fcf8ad66fd09ce1a27e to your computer and use it in GitHub Desktop.
import threading
def count_operation():
for i in range(100):
print(threading.current_thread().getName() + '-' + str(i))
# this is sequential execution - operation right after each other
count_operation()
t1 = threading.Thread(target=count_operation, name='Adam')
t2 = threading.Thread(target=count_operation, name='Bob')
t1.start()
t2.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment