4 ms·
> and audio handlers should never lock mutexes yet I have seen my fair share of them in the wild. They are incorrect. Only bounded-time synchronization primiti
by CyberRabbi 5y ago
> and audio handlers should never lock mutexes yet I have seen my fair share of them in the wild.
They are incorrect. Only bounded-time synchronization primitives can be used. E.g. lock-free queues.
> every thread or event loop should always have a catch-all handler at top level.
Two things. 1) There should be no reason for a properly coded real time audio loop to have a top level handler because exceptions should not be thrown because they cannot be guaranteed to be handled within the necessary time constraints.
2) top level exception handlers divorced from context cannot be handled, only ignored. Ignoring exceptions is very dangerous because there is generally no way for the top level handler to be sure that the rest of the program is in a correct state (unless it knows all code is exception-safe, which is rare). Continuing to run can result in data corruption. Exceptions leaving the context that has the information to handle them is a programming error, just like a failed assertion.
- jcelerier 5y ago> They are incorrect. Only bounded-time synchronization primitives can be used. E.g. lock-free queues. yes, my point is that incorrect code exists in the wild, that's the world we have to live in. > properly coded real time audio loop most things aren't properly coded, and yet still useful
- CyberRabbi 5y agoI see a difference between bugs and design flaws.