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/example1.py:7–10 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
5
y_lock = threading.Lock()
6
7
def
thread_1():
8
while
True:
9
with
acquire(x_lock, y_lock):
10
print(
"Thread-1"
)
11
12
def
thread_2():
13
while
True:
Callers
nothing calls this directly
Calls
1
acquire
Function · 0.90
Tested by
no test coverage detected