Generalize futex observers for the compare_exchanges in lockless_queue
This is necessary to get lockless_queue_death_test running on aarch64.
Change-Id: I621fe55fac4d43a8e40d053d4f069d618e738f7d
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/ipc_lib/index.h b/aos/ipc_lib/index.h
index a47121e..c6a485f 100644
--- a/aos/ipc_lib/index.h
+++ b/aos/ipc_lib/index.h
@@ -2,9 +2,11 @@
#define AOS_IPC_LIB_INDEX_H_
#include <sys/types.h>
+
#include <atomic>
#include <string>
+#include "aos/ipc_lib/shm_observers.h"
#include "glog/logging.h"
namespace aos {
@@ -155,6 +157,7 @@
// Swaps expected for index atomically. Returns true on success, false
// otherwise.
inline bool CompareAndExchangeStrong(QueueIndex expected, QueueIndex index) {
+ linux_code::ipc_lib::RunShmObservers run_observers(&index_, true);
return index_.compare_exchange_strong(expected.index_, index.index_,
::std::memory_order_acq_rel);
}
@@ -242,6 +245,7 @@
// Swaps expected for index atomically. Returns true on success, false
// otherwise.
bool CompareAndExchangeStrong(Index expected, Index index) {
+ linux_code::ipc_lib::RunShmObservers run_observers(&index_, true);
return index_.compare_exchange_strong(expected.index_, index.index_,
::std::memory_order_acq_rel);
}