summaryrefslogtreecommitdiff
path: root/docs/esp32/tutorial
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-04-19 12:17:11 +1000
committerDamien George <damien@micropython.org>2024-04-24 16:24:00 +1000
commit8a3546b3bd71dbc6d79900afbe58767e09b82c3e (patch)
treeb0dda67172d16b89ed37b13d929d909c6ed7e5c5 /docs/esp32/tutorial
parent84d6f8e8cb993e82f03e209ffd49d5c44fc780e0 (diff)
webassembly: Add JavaScript-based asyncio support.
This commit adds a significant portion of the existing MicroPython asyncio module to the webassembly port, using parts of the existing asyncio code and some custom JavaScript parts. The key difference to the standard asyncio is that this version uses the JavaScript runtime to do the actual scheduling and waiting on events, eg Promise fulfillment, timeouts, fetching URLs. This implementation does not include asyncio.run(). Instead one just uses asyncio.create_task(..) to start tasks and then returns to the JavaScript. Then JavaScript will run the tasks. The implementation here tries to reuse as much existing asyncio code as possible, and gets all the semantics correct for things like cancellation and asyncio.wait_for. An alternative approach would reimplement Task, Event, etc using JavaScript Promise's. That approach is very difficult to get right when trying to implement cancellation (because it's not possible to cancel a JavaScript Promise). Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'docs/esp32/tutorial')
0 files changed, 0 insertions, 0 deletions