python threading几种锁

import threading,time

lock=threading.Lock()
lock.acquire()
lock.release()


rlock=threading.RLock()
rlock.acquire()
rlock.release()


semaphore=threading.BoundedSemaphore(3)
semaphore.acquire()
semaphore.release()


clock=threading.Condition()
clock.acquire()
clock.release()
clock.notify()
clock.wait()

with lock:
    pass

with rlock:
    pass

with semaphore:
    pass

with clock:
    pass

你可能感兴趣的:(threading锁)