프로그래밍/Python
Python 공부 노트 9. - Multi thread
Terry Cho
2013. 1. 23. 21:09
http://www.tutorialspoint.com/python/python_multithreading.htm
import threading
class ThreadClass(threading.Thread):
def run(self):
# business logic
..
# lock acquire
threadLock.acquire()
...
# free lock to release
threadLock.release()
threadLock = threading.Lock()
# create new thread
thread1 = ThreadClass()
thread2 = ThreadClass()
thread1.start()
thread2.start()