Multi-threading

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
kollibar
Posts: 1
Joined: Wed May 17, 2017 1:19 pm

Multi-threading

Post by kollibar » Wed May 17, 2017 1:28 pm

Hi,

I'm searching informations about the multi-threading support in MicroPython.
I've seen this topic (one years old) viewtopic.php?f=2&t=1763&p=9956&hilit=m ... ding#p9956 about the uasyncio library.
But I've also seen this issue: https://github.com/micropython/micropython/issues/595 and 4 days ago someone says "Threading is now supported" without other information.
And Pycom is supporting the module _threading on their boards (https://docs.pycom.io/pycom_esp32/pycom ... ading.html).

Today, what the official way to support multi-threading on a pyboard ??

Thanks!

Thom

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Multi-threading

Post by pythoncoder » Thu May 18, 2017 5:31 am

For pre-emptive scheduling MicroPython supports the _thread module. Cooperative multi-tasking is supported via uasyncio, a subset of asyncio. There is an unofficial guide to the latter here https://github.com/peterhinch/micropython-async.
Peter Hinch
Index to my micropython libraries.

thetreerat
Posts: 15
Joined: Thu Apr 27, 2017 6:40 pm

Re: Multi-threading

Post by thetreerat » Thu May 18, 2017 3:44 pm

I have been using uasyncio in my projects on the esp3288 board from adafruit.

it based on the the info in peter's guide. it works for me as I do not need preemptive multitasking. his guide is easier to understand. but if your looking for another example of use you can look at https://github.com/thetreerat/WaterPump.

Hal

Post Reply