drm_hwcomposer: add optional timeout for WaitForSignalOrExitLocked

Change-Id: I5beef0833cc0a384aa76e821694183e024a8850c
diff --git a/worker.h b/worker.h
index 492693c..7015178 100644
--- a/worker.h
+++ b/worker.h
@@ -18,6 +18,7 @@
 #define ANDROID_WORKER_H_
 
 #include <pthread.h>
+#include <stdint.h>
 #include <string>
 
 namespace android {
@@ -46,10 +47,12 @@
   virtual void Routine() = 0;
 
   /*
-   * Must be called with the lock acquired.
-   * Returns -EINTR if interrupted by exit request
+   * Must be called with the lock acquired. max_nanoseconds may be negative to
+   * indicate infinite timeout, otherwise it indicates the maximum time span to
+   * wait for a signal before returning.
+   * Returns -EINTR if interrupted by exit request, or -ETIMEDOUT if timed out
    */
-  int WaitForSignalOrExitLocked();
+  int WaitForSignalOrExitLocked(int64_t max_nanoseconds = -1);
 
  private:
   static void *InternalRoutine(void *worker);