Skip to content

Commit

Permalink
Fix to SafeQueue for mac
Browse files Browse the repository at this point in the history
  • Loading branch information
luigifreda committed Dec 20, 2024
1 parent d28d9ac commit 912a166
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions utilities/utils_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ def get(self, block=True, timeout=None):
with self._lock:
self._size.value -= 1
return item

def get_nowait(self):
"""Remove and return an item from the queue without blocking."""
item = self.queue.get_nowait()
with self._lock:
if item:
self._size.value -= 1
return item

def qsize(self):
"""Return the current size of the queue."""
Expand Down

0 comments on commit 912a166

Please sign in to comment.