That's really useful info, thank you.
Some further research on ManagedBuffer
kicked up this issue by @Karl, which shows that unless you access ManagedBuffer
's header through withUnsafeMutablePointerToHeader
, the Swift runtime is used to enforce exclusivity.
So maybe it's better for me to do as you have done in your RingBuffer and use UnsafeMutableBufferPointer
directly as I'm not confident that the implementation of ManagedBuffer
won't change and suddenly rely on the runtime.
Looks like I'll be copying @Karl 's trick of pasting my real time code into Godbolt and checking for emission of Swift runtime calls to verify realtime safety.
Wish there was a better way!