Updated Threads (markdown)
parent
f1ab95c435
commit
755ff9e08b
|
@ -1,8 +1,8 @@
|
|||
The [_thread](https://docs.micropython.org/en/latest/library/_thread.html) module provides the ability to create additional threads and is intended to implement the API defined by the [equivalent CPython module](https://docs.python.org/3/library/_thread.html). Threading is particularly desirable for microcontrollers with multiple cores in order to achieve greater performance. However, the feature is currently ''experimental'', poorly documented and differs between ports.
|
||||
|
||||
The higher-level [https://docs.python.org/3/library/threading.html threading] module is not yet implemented but cant be built on top of the _thread primitives.
|
||||
The higher-level [threading](https://docs.python.org/3/library/threading.html) module is not yet implemented but cant be built on top of the `_thread` primitives.
|
||||
|
||||
Note that an [https://docs.micropython.org/en/latest/library/uasyncio.html asyncio] solution is often easier to implement, portable and more robust and should be preferred where concurrency (not necessarily parallelism) is required.
|
||||
Note that an [asyncio](https://docs.micropython.org/en/latest/library/uasyncio.html) solution is often easier to implement, portable and more robust and should be preferred where concurrency (not necessarily parallelism) is required.
|
||||
|
||||
Threads are currently supported on ESP32, RP2040 (Pico), STM32, and Unix.
|
||||
|
||||
|
@ -14,7 +14,7 @@ The ESP32 port is built on the ESP IDF which uses FreeRTOS to manage threading.
|
|||
|
||||
Threads are currently created on the same core as the MicroPython interpreter.
|
||||
|
||||
See [https://github.com/micropython/micropython/blob/master/ports/esp32/mpthreadport.c#L139 mpthreadport.c], specifically how xTaskCreatePinnedToCore is used rather than xTaskCreate which would allow FreeRTOS to choose the appropriate core to run on.
|
||||
See [mpthreadport.c](https://github.com/micropython/micropython/blob/master/ports/esp32/mpthreadport.c#L139), specifically how `xTaskCreatePinnedToCore` is used rather than `xTaskCreate` which would allow FreeRTOS to choose the appropriate core to run on.
|
||||
|
||||
There are some complexities that prevent the second core to be used (additional information required!).
|
||||
|
||||
|
|
Loading…
Reference in New Issue