Skip to content

Instantly share code, notes, and snippets.

@kfei
Created August 15, 2014 10:21
Show Gist options
  • Save kfei/0a92fec427c9eef78516 to your computer and use it in GitHub Desktop.
Save kfei/0a92fec427c9eef78516 to your computer and use it in GitHub Desktop.
import multiprocessing
def thread_func():
print "thread in"
while True:
pass
if __name__ == "__main__":
t1 = multiprocessing.Process(target = thread_func)
t1.start()
t2 = multiprocessing.Process(target = thread_func)
t2.start()
t1.join()
t2.join()
from threading import Thread
def thread_func():
print "thread in"
while True:
pass
if __name__ == "__main__":
t1 = Thread(target = thread_func)
t1.start()
t2 = Thread(target = thread_func)
t2.start()
t1.join()
t2.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment