implement timeouts for events
Change-Id: I8ec89fc5bdc7b53ddc1d5c86494615c95be9bd0e
diff --git a/aos/common/event.h b/aos/common/event.h
index 9839d41..b3ee87b 100644
--- a/aos/common/event.h
+++ b/aos/common/event.h
@@ -1,6 +1,8 @@
#ifndef AOS_COMMON_EVENT_H_
#define AOS_COMMON_EVENT_H_
+#include "aos/common/time.h"
+
#include "aos/linux_code/ipc_lib/aos_sync.h"
namespace aos {
@@ -37,6 +39,11 @@
// Waits for the event to be set. Returns immediately if it is already set.
void Wait();
+ // Waits for the event to be set or until timeout has elapsed. Returns
+ // immediately if it is already set.
+ // Returns true if the event was Set or false if the timeout expired.
+ bool WaitTimeout(const ::aos::time::Time &timeout);
+
// Wakes up all Wait()ers and sets the event (atomically).
void Set();
// Unsets the event so future Wait() callers will block instead of returning