A very Simple Asynchronous Program Framework for micropython #11045
Replies: 4 comments 8 replies
-
Workers-Framework may be of interest if you want to do cooperative multitasking with MicroPython. Please take a look; you might find it useful. |
Beta Was this translation helpful? Give feedback.
-
Not sure if I remember correctly, do you have a |
Beta Was this translation helpful? Give feedback.
-
@peterhinch, I recommended asyncio to people who want to use asyncio style concurrency. My view to programming language, libraries, frameworks are as tools. Workers-frameworks have different philosophy then asyncio. The workers-frameworks is easy to understand, it is cooperative multitasking. By using yield statements a task can have more or less CPU resources programmatically and it is transparent. A task uses massage-passing to send and receive data from other tasks. The principles on which workers-framework is based are easy to understand, imagine a group of friends in a kitchen cooking food for a party. There are a lot of things in asyncio that I do not understand. For example (from your example)
Why do you need to run the I know you have invested a lot in the asyncio work for MicroPython, we are all grateful, including me. The workers-framework is implemented in Python and is also transferable. It is up to you which concurrency model you want to use, there are many besides asyncio. These are just tools, nothing more. Have you read this blog "The Heisenbug lurking in your async code"? |
Beta Was this translation helpful? Give feedback.
-
Issuing The blog is very interesting but I don't believe it applies to MicroPython. The CPython docs state
If you look at the MP code, It is obviously up to the individual how they approach coding. My personal view is that the Workers-Framework approach to handling a stream is inelegant and inefficient. A loop like if u.any()==0:
yield is clunky and inefficient compared to the In my opinion learning an alternative async paradigm is likely to be wasted effort. Sooner or later you will need functionality not offered by the framework: when that happens you'll have to tackle All IMHO, of course :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The purpose of this project is to create a simple and easy-to-use framework for micropython asynchronous programs. Simply create the user's own task files, then add the task file name and task function to the configuration file, and the system will automatically create and run the task.
Framework files
The framework itself has three files:
https://github.com/shaoziyang/SimpleAsynchronousProgramFramework
Beta Was this translation helpful? Give feedback.
All reactions