commit | a76d4d889979a732bf01e3eeac4e1ae1028c24ac | [log] [tgz] |
---|---|---|
author | Bart Van Assche <bvanassche@google.com> | Mon Nov 06 12:51:38 2023 -0800 |
committer | Bart Van Assche <bvanassche@google.com> | Mon Nov 06 16:01:16 2023 -0800 |
tree | 82545b952fd007657890468efde0a6def4c8b6d8 | |
parent | 3143e6930b75c4b40b1691f33faa10fe6670ecf6 [diff] |
audio: Simplify AudioHalBinderServiceUtil::waitForFired() Return the std::condition::wait_for() return value instead of reading the variable 'fired' again. See also https://en.cppreference.com/w/cpp/thread/condition_variable/wait_for. Change-Id: I48c270f5446f61b2ad828b19a1fc294737a123dd Signed-off-by: Bart Van Assche <bvanassche@google.com>
diff --git a/audio/aidl/vts/AudioHalBinderServiceUtil.h b/audio/aidl/vts/AudioHalBinderServiceUtil.h index b4b4632..403690e 100644 --- a/audio/aidl/vts/AudioHalBinderServiceUtil.h +++ b/audio/aidl/vts/AudioHalBinderServiceUtil.h
@@ -71,8 +71,7 @@ bool waitForFired(std::chrono::milliseconds timeoutMs) { std::unique_lock<std::mutex> lock(mutex); - condition.wait_for(lock, timeoutMs, [this]() { return fired; }); - return fired; + return condition.wait_for(lock, timeoutMs, [this]() { return fired; }); } private: