Timur Doumler Talks on C++ Audio (Sharing data across threads)

Yesterday, after posting in this thread, I had a delightful conversation with standard library implementers on Twitter:

Bottom line:

  • contrary to what I said earlier, we probably won’t get lock-free atomic<shared_ptr> in the standard library.
  • contrary to what I said earlier, we don’t actually know yet whether they’re implementable. Two people claim to have an implementation, but they’re not open source and there are doubts whether the implementations are correct+conforming;
  • regardless of any of that, and contrary to what I said in my 2015 talk, std::shared_ptr seems to be fundamentally the wrong tool for the use case of sharing objects across threads, of which one is a realtime thread, and the pattern I described is actually fundamentally broken and unsafe.

I need to go off and rethink all this. Expect a blog post from me when I figured it out :slight_smile:

How do you do this in your codebases? How do you share objects across threads, of which one is a realtime processing thread?