Move bionic_systrace.cpp over to CachedProperty.
This is the last bionic caller that was manually trying to cache
property values.
Bug: N/A
Test: builds and boots
Change-Id: Id66c0a05d8448f08c39dbf7189241e75615d44b4
diff --git a/libc/private/CachedProperty.h b/libc/private/CachedProperty.h
index f0c81c9..417a855 100644
--- a/libc/private/CachedProperty.h
+++ b/libc/private/CachedProperty.h
@@ -46,6 +46,14 @@
cached_value_[0] = '\0';
}
+ // Returns true if the property has been updated (based on the serial rather than the value)
+ // since the last call to Get.
+ bool DidChange() {
+ uint32_t initial_property_serial_ = cached_property_serial_;
+ Get();
+ return (cached_property_serial_ != initial_property_serial_);
+ }
+
// Returns the current value of the underlying system property as cheaply as possible.
// The returned pointer is valid until the next call to Get. It is the caller's responsibility
// to provide a lock for thread-safety.