X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;ds=inline;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fcommon%2Fwait_handle.h;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fcommon%2Fwait_handle.h;h=37c12c6233f76639feb59d908da34fdb554983fe;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git
diff --git a/src/type3_AndroidCloud/anbox-master/src/anbox/common/wait_handle.h b/src/type3_AndroidCloud/anbox-master/src/anbox/common/wait_handle.h
new file mode 100644
index 0000000..37c12c6
--- /dev/null
+++ b/src/type3_AndroidCloud/anbox-master/src/anbox/common/wait_handle.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright © 2012 Canonical Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Authored by: Thomas Guest
+ * Daniel van Vugt
+ */
+
+#ifndef ANBOX_COMMON_WAIT_HANDLE_H_
+#define ANBOX_COMMON_WAIT_HANDLE_H_
+
+#include
+#include
+#include
+
+namespace anbox {
+namespace common {
+struct WaitHandle {
+ public:
+ WaitHandle();
+ ~WaitHandle();
+
+ void expect_result();
+ void result_received();
+ void wait_for_all();
+ void wait_for_one();
+ void wait_for_pending(std::chrono::milliseconds limit);
+
+ bool has_result();
+ bool is_pending();
+
+ private:
+ std::mutex guard;
+ std::condition_variable wait_condition;
+
+ int expecting;
+ int received;
+};
+} // namespace common
+} // namespace anbox
+
+#endif