💾 Archived View for freeshell.de › gemlog › 2023-12-27_Tiny_thread_issues.gmi captured on 2024-05-26 at 14:46:04. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-12-28)
-=-=-=-=-=-=-
To make sounds on the Thumby while something else is happening you need threads. In a sane world, spawn all the threads you want, and the machine does its best to allocate processing time to them using whatever cores it has and/or time sharing. Not on Thumby. There are two cores, and that means two threads max. I've been playing tunes by starting a new thread every time, and it's worked. Each thread ends before it's time for another tune to play. Except when it doesn't. Sometimes a tune thread hangs around. Then when it's time for another tune, that's a third thread and "OSError: core1 in use" and it crashes.
The upshot of all this is I need one music thread that's always running, and I need to grok some Python stuff about sharing and/or passing data between threads. I'm not happy because it was all working fine. Or so I thought.
Grumble, grumble...