Fix/fifo race (#1591) (#1595)
Build on RHEL9 docker image / build (push) Successful in 4m12s
Build on RHEL8 docker image / build (push) Successful in 5m23s
Run Simulator Tests on local RHEL9 / build (push) Successful in 19m29s
Run Simulator Tests on local RHEL8 / build (push) Successful in 22m59s

* fix race condition in Fifo::FreeAddress

(cherry picked from commit dd5b2360d6)
This commit is contained in:
Erik Fröjdh authored and GitHub committed 2026-10-05 15:03:35 +02:00
1 parent 853f48b7fe
commit 6ee4239659
2 files changed
+8 -1

No files matched your search

+4 -1
View File
@@ -81,7 +81,10 @@ void Fifo::DestroyFifos() {
fifoStream = nullptr;
}
void Fifo::FreeAddress(char *&address) { fifoFree->push(address); }
void Fifo::FreeAddress(char *&address) {
std::lock_guard<std::mutex> lock(fifoFreeMutex);
fifoFree->push(address);
}
void Fifo::GetNewAddress(char *&address) {
int temp = fifoFree->getDataValue();
+4
View File
@@ -16,6 +16,7 @@
#include "sls/sls_detector_defs.h"
#include <atomic>
#include <mutex>
namespace sls {
@@ -52,6 +53,9 @@ class Fifo : private virtual slsDetectorDefs {
int fifoDepth;
std::atomic<int> status_fifoBound;
std::atomic<int> status_fifoFree;
/** fifoFree has several producers, CircularFifo allows only one.
* Aligned to avoid false sharing with the members above */
alignas(128) std::mutex fifoFreeMutex;
};
} // namespace sls