Quantcast
Viewing all articles
Browse latest Browse all 4909

MicroPython • Re: multithreading with Raspberry Pi Pico

Are you saying that MicroPython does handle contention, atomicity, etc? Or that it should?
I'm saying it should, because that's what people using MicroPython would be expecting.

Especially since I don't see anything in the documentation saying users have to handle that themselves nor how to.
Does CPython handle contention, atomicity, etc? As far as I understand it, it leaves that to the underlying OS.
I have no idea how it does it but I have never had any problem with threading using CPython.

With MicroPython I would expect the same, or documentation which explains it's not, and what to do about it.
rp2 starts _thread on the second core, but leaves everything about contention, etc, up to you.
Can you find anything in the documentation which says that, explains how to deal with those issues?

I haven't.
If the official Raspberry Pi MicroPython docs says it's safe to use _thread, we should get that error fixed.
It's more that it doesn't say it's not safe to use, may crash and burn if the prerequisite steps aren't taken to prevent that, doesn't say what those prerequisite steps are and how they should be implemented.

The examples I have seen are all along the lines of 'import _thread, run the second thread' and gives the impression that's all there is to it, that there's no special precautions which must be taken.
As for the "TinyUSB callback can't recurse" problem, there is a PR in to fix it, but it looks like it needs other work.
Hopefully fixed soon as that seems a bit of a showstopper.
I do see that I could be (slightly) accused of trying to absolve MicroPython of any problems. I am trying hard not to do that. I feel that MicroPython is often oversold as "Python for micro-controllers", when it's really "A language with Python-like syntax for very small systems: be delighted that anything works at all"
You could be right. I certainly bought into believing it was "Python for micro-controllers", accepted some things would inevitably be somewhat different or have some things missing, be more constrained, but otherwise "Python".

However I would say it does manage to be "Python" exceedingly well, and impressively so. It seems it's only really threading where that's fallen down.

Statistics: Posted by hippy — Wed Jul 31, 2024 6:40 pm



Viewing all articles
Browse latest Browse all 4909

Trending Articles