Open bepzi opened 2 years ago
Regardless of the answer, I'd like to make sure the try_lock()
code isn't compiled for release builds.
Alternatively, careful use of std::atomic<bool>
might be enough to track whether the Rust AudioProcessor is currently "in use" by another thread. Then we don't need an entire mutex, and I can be confident that what we're doing is realtime safe.
My clever trick with
try_lock()
might not be realtime safe, even if we intend not to acquire the lock, since it might interact with the OS thread scheduler regardless: https://www.youtube.com/watch?v=Tof5pRedskI&t=2280sAlthough in the Q&A sessions, the speaker does imply that if everyone is doing
try_lock()
and neverlock()
, it might be okay?Originally posted by @bepzi in https://github.com/bepzi/elysium/issues/10#issuecomment-1009514407