IMO the official MicroPython documentation on threading provides the necessary guidance as it currently stands -This is the kind of feature that needs an entire chapter with many examples in the official documentation, so that users get some guidance of what they are getting into.
The only improvement on that might be "here be dragons", "enter at your own risk", "don't expect it to work as you might expect it to", "there likely are bugs in the experimental implementation".
This module is highly experimental and its API is not yet fully settled and not yet described in this documentation.
And, when it ceases to be experimental, it should just work, and then there's not much need to provide more than the examples we already have. Though if locking is needed then that will need to be described as none of the examples I have seen implement locking.
The existing examples otherwise seem fine - The issue is simply that they don't always work as expected because threading is an experimental feature.
The root problem is that those providing examples of threading don't warn people about the experimental nature of threading.
Or donate money to the MicroPython Team or sponsor the project. Raspberry Pi could do that if they wanted Pico users to be able to get the experience with threading they expect from the MicroPython they support and promote for use on the Pico.[Edit] That is, the best fix is upstream. Or someone can donate time and effort to work it all out.
The only sensible fix is upstream. I would encourage those who believe they can help with that to work with the MicroPython team to that end, issue Pull Requests if they have fixes.
I don't see the point of documenting something which is shifting sand. Nor doing so when the best which can be offered is "this might work", "it worked for me, but YMMV".Best case scenario for me would be to have known-good guidance + examples. That would help a lot of coders.
In this case, examples of what works and what doesn't are equally important, best practices, recommendations on how to manage data objects, etc. Things work better for coders when they have reliable known-good code that they can copy-and-paste.
Others have attempted to do that in the past, one example - viewtopic.php?t=326826
I don't know how well that has stood up to the test of time.
Statistics: Posted by hippy — Mon Dec 09, 2024 11:15 am