split try_pop and pop

This commit is contained in:
Olivier R-D 2013-08-28 15:43:59 +02:00
parent 75d3184637
commit 73f876c825

View File

@ -181,7 +181,7 @@ class URRTMonitor(threading.Thread):
def stop_buffering(self):
self._buffering = False
def pop_buffer(self):
def try_pop_buffer(self):
"""
return oldest value in buffer
"""
@ -191,6 +191,17 @@ class URRTMonitor(threading.Thread):
else:
return None
def pop_buffer(self):
"""
return oldest value in buffer
"""
while True:
with self._buffer_lock:
if len(self._buffer) > 0:
return self._buffer.pop(0)
time.sleep(0.001)
def get_buffer(self):
"""
return a copy of the entire buffer