platform_system_core/base
Tom Cherry 3d5729402e Fix timeouts for android::base::WaitForProperty*
std::chrono doesn't handle integer overflow, so using
std::chrono::milliseconds::max() to indicate an infinite timeout is
not handled well in the current code.  It causes an 'absolute_timeout'
earlier in time than 'now' and causes the associated WaitForProperty*
functions to return immediately.

Also, any duration_cast from relative_timeout to nanoseconds would
cause the same issue, as it would overflow in the conversion and
result in an invalid results.

This change prevents any duration_casts of relative_timeout to
nanoseconds and replaces the logic to wait on an absolute timeout with
logic that compares the time elapsed to the provided relative timeout.

This change also includes a test that std::chrono::milliseconds::max()
does not return immediately and that negative values do return immediately.

Test: Boot bullhead + libbase_test

Change-Id: I335bfa7ba71e86c20119a0ed46014cad44361162
2017-03-27 18:05:58 -07:00
..
include/android-base Fix timeouts for android::base::WaitForProperty* 2017-03-27 18:05:58 -07:00
.clang-format Remove extraneous .clang-format files 2017-03-14 14:06:31 -07:00
Android.bp Add cross-platform <android-base/endian.h>. 2017-02-24 14:03:36 -08:00
CPPLINT.cfg Don't show lint errors for rvalue references. 2015-04-02 18:38:01 -07:00
endian_test.cpp Add cross-platform <android-base/endian.h>. 2017-02-24 14:03:36 -08:00
errors_test.cpp base: add SystemErrorCodeToString() function. 2016-02-01 12:18:26 -08:00
errors_unix.cpp base: add SystemErrorCodeToString() function. 2016-02-01 12:18:26 -08:00
errors_windows.cpp base: add SystemErrorCodeToString() function. 2016-02-01 12:18:26 -08:00
file.cpp Keep the ReadFileToString/ReadFdToString overhead down. 2017-03-21 13:43:08 -07:00
file_test.cpp Keep the ReadFileToString/ReadFdToString overhead down. 2017-03-21 13:43:08 -07:00
logging.cpp base: support logging before enter main function. 2017-01-25 15:50:47 -08:00
logging_test.cpp base: support logging before enter main function. 2017-01-25 15:50:47 -08:00
parsedouble_test.cpp libbase: add parsedouble.h. 2016-10-19 11:19:42 -07:00
parseint_test.cpp Move off std::sto* function which abort on failure. 2016-10-13 15:34:05 -07:00
parsenetaddress.cpp base: add network address parsing function from adb. 2016-01-21 20:03:33 -08:00
parsenetaddress_test.cpp base: add network address parsing function from adb. 2016-01-21 20:03:33 -08:00
properties.cpp Fix timeouts for android::base::WaitForProperty* 2017-03-27 18:05:58 -07:00
properties_test.cpp Fix timeouts for android::base::WaitForProperty* 2017-03-27 18:05:58 -07:00
quick_exit.cpp Remove mutex.h and its uses. 2016-09-16 15:58:00 -07:00
quick_exit_test.cpp base: add quick_exit emulation. 2016-09-13 17:54:50 -07:00
stringprintf.cpp Track rename of base/ to android-base/. 2015-12-04 22:00:26 -08:00
stringprintf_test.cpp Track rename of base/ to android-base/. 2015-12-04 22:00:26 -08:00
strings.cpp Fix ubsan failure in android::base::Split. 2017-02-13 14:13:24 -08:00
strings_test.cpp Fix ubsan failure in android::base::Split. 2017-02-13 14:13:24 -08:00
test_main.cpp Track rename of base/ to android-base/. 2015-12-04 22:00:26 -08:00
test_utils.cpp libbase: fix the way to find temp dir. 2017-02-13 15:50:56 -08:00
utf8.cpp Track rename of base/ to android-base/. 2015-12-04 22:00:26 -08:00
utf8_test.cpp Fix a couple sign-comparison warnings. 2016-01-15 12:18:14 -08:00