Created
August 15, 2014 10:21
-
-
Save kfei/0a92fec427c9eef78516 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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() |
This file contains hidden or 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
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