How to interrupt/stop the main thread and have to do something else #12026
Replies: 4 comments 4 replies
-
A possible approach is to run |
Beta Was this translation helpful? Give feedback.
-
In my opinion, your usage of (blocking) urequest is the main problem here. |
Beta Was this translation helpful? Give feedback.
-
In the reference you gave there is also 3.9.3. An asynchronous web server. Did you try that too? And isn't it what you need? |
Beta Was this translation helpful? Give feedback.
-
@GM-Script-Writer-62850 I made an async_urequest.py version that may be of help (just delete/comment the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Issues i am trying to work around:
uasyncio
can only be used on a single core as far as i know so if it is on core 1 it can't be used for a server on a pico wuasyncio
coreLets assume this example is running on core 0 with
uasyncio
on core 1:3.9.1. A simple server for static pages (not planning on doing anything heavy, just need to receive a few bytes of data)
Most of the time will be spent on line 54 waiting on a client, i can trigger a interrupt from core 1 by toggling output pin tied to a irq, but said interrupt can't use the NIC and _thread.interrupt_main() is not implemented
With
s.accept()
in progress i can't just have a loop and check if there is something else to do, any idea of how to work around the limitations? the only thing i can think of would be upgradinguaiohttpclient.py
thus not needing urequest to run on core 0 allowing my to useuasyncio
on core 0 where it can run a sever and useuaiohttpclient.py
then i can just use core 1 for slow stuff like reading sensors like DHT22sBeta Was this translation helpful? Give feedback.
All reactions