PcloudStimProd: make sh_ptrs to Pcloud*StimBuff atomic<>

This change is a bit pedantic, but since these vars aren't accessed
in any hotpath, it's fine to be pedantic. We made these sh_ptrs
atomic so we can use acquire and release side effects when loading
and storing them. This doesn't eliminate the problem of seeing
inconsistent state across microcontrollers, but it helps with simple
accesses like these ones we already do.
This commit is contained in:
2025-11-26 00:11:40 -04:00
parent edab71b823
commit 5cce473e01
4 changed files with 46 additions and 31 deletions
-7
View File
@@ -99,10 +99,3 @@ cancelation problem described above, concerning
StimulusBuffer::start/stop(), and ensuring that after
stop() has returned, we can be reasonably sure that all
in-flight ops have exited.
Making sh_ptr<StimulusBuffer> atomic for mem barriers:
We could also complete our implemetation's correctness by converting
the sh_ptrs to StimulusBuffer inside of the PCloudStimulusProducer
into std::atomic<std::shared_ptr<StimulusBuffer>>, and using
std::memory_order_release/memory_order_acquire when writing and
reading them respectively.