threadingモジュールの Lock, RLock, Condition, Semaphore オブジェクトを使う # -*- coding: utf-8 -*- import threading import time LOCK = threading.Lock() def func(): for i in range(10): time.sleep(0.1) print i, print def lock_func(): # with文を使わない場合はacquireとreleaseメソッドを使う with LOCK: func() a = threading.Thread(target=func) b = threading.Thread(target=func) print "unlock" a.start() b.start() a.join() b.join() c = th