multitasking services

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
devnull
Posts: 54
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall

multitasking services

Postby devnull » Fri Mar 17, 2017 8:57 am

There are some things that appear to be started as a service, for example webrepl and run in the background allowing for the main code to run independently.

So without threading, how is this achieved ?

User avatar
Roberthh
Posts: 531
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: multitasking services

Postby Roberthh » Fri Mar 17, 2017 10:48 am

Webrepl uses a special non-standard mechanisms, which offers a callback mechsnism for sockets. That's all. The same mechanism can be used by python scripts, like by examples ot a ftp and telnet server, but this mechansism is not guaranteed to persist and is by no means a multitasking method. If a callback is triggered, it will interrupt the other code execution, how long that may take, until it returns.

User avatar
fdushin
Posts: 28
Joined: Thu Jul 21, 2016 5:38 pm

Re: multitasking services

Postby fdushin » Sun Mar 19, 2017 11:46 pm

For a while I tried using some undocumented callbacks in the socket interface to allow server sockets to accept connections in the background [1]. This proved to be unworkable except in the most trivial cases, so I moved to using uasyncio, and the results are much better.

-Fred

[1] https://github.com/fadushin/esp8266/blo ... pd.py#L406


Return to “ESP8266 boards”

Who is online

Users browsing this forum: No registered users and 1 guest