Питоны замки

import threading

lock = threading.Lock()

lock.acquire()
# Do stuff
lock.release()
The Nic