summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-09-29 08:23:37 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-09-29 08:23:37 +0000
commit6d47eaa9c92d1da94545860708f663856cfdc951 (patch)
tree880ecf37acfd3702c823f99092b9bae3aca7620b
parent68baa27c05c2f3f35e2c6f7ea6cc6fd36a0fa500 (diff)
parentfe148ed9dc078bedd66a3ed69bdd3a327ec832ed (diff)
downloaddevice_google_contexthub-6d47eaa9c92d1da94545860708f663856cfdc951.tar.gz
device_google_contexthub-6d47eaa9c92d1da94545860708f663856cfdc951.tar.bz2
device_google_contexthub-6d47eaa9c92d1da94545860708f663856cfdc951.zip
release-request-fbd98711-169e-4972-a5f2-db043df00e09-for-git_pi-release-4367572 snap-temp-L13500000107248413
Change-Id: I8547b540b8beb3263f157e99a5df63b901b30d4e
-rw-r--r--contexthubhal/system_comms.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/contexthubhal/system_comms.h b/contexthubhal/system_comms.h
index 6991457e..d9490830 100644
--- a/contexthubhal/system_comms.h
+++ b/contexthubhal/system_comms.h
@@ -19,6 +19,7 @@
#include <utils/Condition.h>
+#include <chrono>
#include <condition_variable>
#include <map>
#include <mutex>
@@ -173,8 +174,13 @@ private:
}
int wait() {
std::unique_lock<std::mutex> lk(mDoneMutex);
- mDoneCond.wait(lk, [this] { return mState == SESSION_DONE; });
- return 0;
+ bool success = mDoneCond.wait_for(
+ lk, std::chrono::seconds(30),
+ [this] { return mState == SESSION_DONE; });
+ if (!success) {
+ ALOGE("Timed out waiting for response");
+ }
+ return success ? 0 : -1;
}
virtual int getState() const override {
std::lock_guard<std::mutex> _l(mDoneMutex);