Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/dabeaz/python-cookbook
/ thread_1
Function
thread_1
src/12/locking_with_deadlock_avoidance/example2.py:9–14 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
7
y_lock = threading.Lock()
8
9
def
thread_1():
10
while
True:
11
with
acquire(x_lock):
12
with
acquire(y_lock):
13
print(
"Thread-1"
)
14
time.sleep(1)
15
16
def
thread_2():
17
while
True:
Callers
nothing calls this directly
Calls
1
acquire
Function · 0.90
Tested by
no test coverage detected