Skip to content

Asyncio ThreadSafeQueue and _thread: Program stops after some time without error message #17628

Discussion options

You must be logged in to vote

@de-dh You have asynchronous routines running in two threads. This is invalid. Asyncio is based on a task queue which is not thread safe.

I think you are misunderstanding the relationship between threads and cores. On ESP32 MicroPython runs on a single processor core. Threading is implemented by pre-emptive context switching on that one core, with FreeRTOS running on the other core. As @shariltumin says, RP2 works differently: there is no underlying OS and threads map directly onto cores. This is unique to RP2.

My approach to your problem would be to abandon threading and to rely on asyncio for concurrency.

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by de-dh
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@peterhinch
Comment options

@de-dh
Comment options

@peterhinch
Comment options

@de-dh
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy