← index #5828Issue #124
Related · high · value 1.985
QUERY · ISSUE

extmod/uasyncio: Queue is missing

openby tveopened 2020-03-28updated 2020-03-30

The new uasyncio doesn't have a Queue class (unless I'm getting blind?). That seems like a pretty core sync primitive. Should this be added or should that go into a separate library? There's also Condition, Semaphone and more... Where should such a library go or what is the plan?

CANDIDATE · ISSUE

uasyncio.queue: bug testing queue size in put() function

closedby BrendanSimonopened 2016-11-25updated 2016-12-08

The put() function tests for queue size greater than max queue size, instead of queue size greater than or equal to max queue size.

diff --git a/uasyncio.queues/uasyncio/queues.py b/uasyncio.queues/uasyncio/queues.py
index 4a8ae5f..04918ae 100644
--- a/uasyncio.queues/uasyncio/queues.py
+++ b/uasyncio.queues/uasyncio/queues.py
@@ -61,7 +61,7 @@ class Queue:
 
             yield from queue.put(item)
         """
-        while self.qsize() > self.maxsize and self.maxsize:
+        while self.qsize() >= self.maxsize and self.maxsize:
             yield from sleep(self._attempt_delay)
         self._put(val)
2 comments
pfalcon · 2016-12-08

Thanks for the report. uasyncio.queues was contributed (I didn't look into it myself much), but the fix looks right, especially that in put_nowait() it uses >=. Merging.

@nvbn: FYI

pfalcon · 2016-12-08

Fixed, thanks.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied