Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/dabeaz/python-cookbook
/ philosopher
Function
philosopher
src/12/locking_with_deadlock_avoidance/example3.py:5–8 ·
view source on GitHub ↗
(left, right)
Source
from the content-addressed store, hash-verified
3
4
# The philosopher thread
5
def
philosopher(left, right):
6
while
True:
7
with
acquire(left,right):
8
print(threading.currentThread(),
'eating'
)
9
10
# The chopsticks (represented by locks)
11
NSTICKS = 5
Callers
nothing calls this directly
Calls
1
acquire
Function · 0.90
Tested by
no test coverage detected