summaryrefslogtreecommitdiff
path: root/libs/ui/BufferHubBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ui/BufferHubBuffer.cpp')
-rw-r--r--libs/ui/BufferHubBuffer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/ui/BufferHubBuffer.cpp b/libs/ui/BufferHubBuffer.cpp
index 226b6ee9ad..0582e1afe7 100644
--- a/libs/ui/BufferHubBuffer.cpp
+++ b/libs/ui/BufferHubBuffer.cpp
@@ -169,6 +169,13 @@ int BufferHubBuffer::ImportGraphicBuffer() {
buffer_state_ = &metadata_header->buffer_state;
fence_state_ = &metadata_header->fence_state;
active_clients_bit_mask_ = &metadata_header->active_clients_bit_mask;
+ // The C++ standard recommends (but does not require) that lock-free atomic operations are
+ // also address-free, that is, suitable for communication between processes using shared
+ // memory.
+ LOG_ALWAYS_FATAL_IF(!std::atomic_is_lock_free(buffer_state_) ||
+ !std::atomic_is_lock_free(fence_state_) ||
+ !std::atomic_is_lock_free(active_clients_bit_mask_),
+ "Atomic variables in ashmen are not lock free.");
// Import the buffer: We only need to hold on the native_handle_t here so that
// GraphicBuffer instance can be created in future.