MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / MyQueue

Class MyQueue

example_code/item_070.py:65–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63from threading import Lock
64
65class MyQueue:
66 def __init__(self):
67 self.items = deque()
68 self.lock = Lock()
69
70
71 print("Example 3")
72 def put(self, item):
73 with self.lock:
74 self.items.append(item)
75
76
77 print("Example 4")
78 def get(self):
79 with self.lock:
80 return self.items.popleft()
81
82
83print("Example 5")

Callers 1

item_070.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected