diff options
author | Mark Salyzyn <salyzyn@google.com> | 2015-04-24 09:31:32 -0700 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2015-04-28 22:20:41 +0000 |
commit | 123927dffc28018a1feb1d42c625b601cb948f34 (patch) | |
tree | 905fe666bf92ebcfb4f33a5b71f721c5342ab3d3 /libc/bionic | |
parent | 452742d2bf4247106055696c11bc4e59ca630f11 (diff) | |
download | bionic-123927dffc28018a1feb1d42c625b601cb948f34.zip bionic-123927dffc28018a1feb1d42c625b601cb948f34.tar.gz bionic-123927dffc28018a1feb1d42c625b601cb948f34.tar.bz2 |
bionic: add __system_property_area_serial()
Adds a new _internal_ function. Provide a global serial number to
support more efficient private caching algorithms. This allows
to skip re-running the __system_property_find() call on misses until
there is a global change in the properties. This call is a read
barrier, the property data to be read following this call will be
read sequentially and up to date.
(Cherry pick from bfd65279a5a9018b01f71773270e462f1b9a7768)
Bug: 19544788
Change-Id: I58e6a92baa0f3e8e7b9ec79b10af6d56407dab48
Diffstat (limited to 'libc/bionic')
-rw-r--r-- | libc/bionic/system_properties.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libc/bionic/system_properties.cpp b/libc/bionic/system_properties.cpp index aae99b1..c436a16 100644 --- a/libc/bionic/system_properties.cpp +++ b/libc/bionic/system_properties.cpp @@ -598,6 +598,16 @@ int __system_property_area_init() return map_prop_area_rw(); } +unsigned int __system_property_area_serial() +{ + prop_area *pa = __system_property_area__; + if (!pa) { + return -1; + } + // Make sure this read fulfilled before __system_property_serial + return atomic_load_explicit(&(pa->serial), memory_order_acquire); +} + const prop_info *__system_property_find(const char *name) { if (__predict_false(compat_mode)) { |