diff options
author | Elliott Hughes | 2017-02-16 19:14:10 -0600 |
---|---|---|
committer | Elliott Hughes | 2017-02-21 16:57:15 -0600 |
commit | 03edc9f7647b3ac9db8a4743acc98b0238b846fb (patch) | |
tree | d71a6b4c41b569f7673f4388ab50cc10b2d97eb3 /base/include/android-base/properties.h | |
parent | 01815fdcc52e6e94fe078d34ffdd71752e1aafdc (diff) | |
download | platform-system-core-03edc9f7647b3ac9db8a4743acc98b0238b846fb.tar.gz platform-system-core-03edc9f7647b3ac9db8a4743acc98b0238b846fb.tar.xz platform-system-core-03edc9f7647b3ac9db8a4743acc98b0238b846fb.zip |
Add timeout support to android::base::WaitForProperty.
Bug: http://b/35201172
Test: ran tests
Change-Id: I025aa0217dc94fabf0eb076b285a84866b00e741
Diffstat (limited to 'base/include/android-base/properties.h')
-rw-r--r-- | base/include/android-base/properties.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/base/include/android-base/properties.h b/base/include/android-base/properties.h index e275fa2a4..e2324b785 100644 --- a/base/include/android-base/properties.h +++ b/base/include/android-base/properties.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #error Only bionic supports system properties. | 23 | #error Only bionic supports system properties. |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #include <chrono> | ||
26 | #include <limits> | 27 | #include <limits> |
27 | #include <string> | 28 | #include <string> |
28 | 29 | ||
@@ -58,8 +59,12 @@ template <typename T> T GetUintProperty(const std::string& key, | |||
58 | // tell you whether or not your call succeeded. A `false` return value definitely means failure. | 59 | // tell you whether or not your call succeeded. A `false` return value definitely means failure. |
59 | bool SetProperty(const std::string& key, const std::string& value); | 60 | bool SetProperty(const std::string& key, const std::string& value); |
60 | 61 | ||
61 | // Waits for the system property `key` to have the value `expected_value`, . | 62 | // Waits for the system property `key` to have the value `expected_value`. |
62 | void WaitForProperty(const std::string& key, const std::string& expected_value); | 63 | // Times out after `relative_timeout`. |
64 | // Returns true on success, false on timeout. | ||
65 | bool WaitForProperty(const std::string& key, | ||
66 | const std::string& expected_value, | ||
67 | std::chrono::milliseconds relative_timeout); | ||
63 | 68 | ||
64 | } // namespace base | 69 | } // namespace base |
65 | } // namespace android | 70 | } // namespace android |