Repository navigation
Conversation
ipoll() allows to poll streams without allocating any memory: this method returns an iterator (a poll object itself), and the iterator yields preallocated "callee-owned tuple" with polling results for each active stream. The only operation a caller is allowed to do with this tuple is extracting values from it (storing the tuple as a whole somewhere is not allowed).
|
Implementation of #1550 (comment) . Not fully tested. |
dpgeorge
left a comment
There was a problem hiding this comment.
Looks ok.
But what's the plan with implementing it for baremetal in extmod/moduselect? Will this unix version serve as a reference and then the extmod version can follow, or will they eventually be merged into 1 implementation?
There was a problem hiding this comment.
This could be inlined here (ie mp_obj_tuple_t) to reduce fragmentation.
There was a problem hiding this comment.
I was bit by inlining once, so don't feel like practicing it again. Here's it's also an "optimization", if ipoll is not used, tuple is not allocated. And overall, before playing with inlining and stuff, and I'd like to see a compacting GC implemented, that would require tightening up object refs vs object ptrs matters in many places, no need to complicate it more with adhoc optimizations IMHO.
Yes, extmod/moduselect will follow once this is well tested. As discussed previously, they use very different mechanism underlyingly, so I don't see a way to factor out anything (well, much enough to bother) common from them. |
|
Also, once moduselect's are updated, uasyncio will need to be updated, which will make it incompatible with the current uPy release. So, we'd need to make a new release, and probably can start planning it. |
|
Ok. Feel free to merge when it's ready. |
|
Merged. |
mimxrt10xx: add one-directional SPI
ipoll() allows to poll streams without allocating any memory: this method
returns an iterator (a poll object itself), and the iterator yields
preallocated "callee-owned tuple" with polling results for each active
stream. The only operation a caller is allowed to do with this tuple is
extracting values from it (storing the tuple as a whole somewhere is
not allowed).