with some_lock: # do something...
等於
some_lock.acquire() try: # do something... finally: some_lock.release()
https://www.bogotobogo.com/python/Multithread/python_multithreading_Using_Locks_with_statement_Context_Manager.php
with some_lock: # do something...
some_lock.acquire() try: # do something... finally: some_lock.release()
沒有留言:
張貼留言