INNER CODE UNIT · Python
get_item
bkbilly/lnxlink · lnxlink/__main__.py:70
def get_item(self, timeout=None):
"""Retrieves and removes the next item from the queue (FIFO)"""
with self._condition:
if not self.queue and timeout is not None:
self._condition.wait(timeout=timeout)
if self.queue:
_, item = self.queue.popitem(last=False)
name, value, retain, force_publish = item
return name, (value, retain, force_publish)
return None, None
def notify_all(self):
"""Wakes up all threads waiting on the queue"""
with self._condition:
self._condition.notify_all()
def clear(self):
"""Clears all items from the queue"""