Handle spurious futex wakes in EventFlag

Sometimes a return value of 0 from FUTEX_WAIT_BITSET can mean
a spurious wakeup. EventFlag should examine the futex
word's value on a wake and return an appropriate
error code.

Test: Fixes issue in b/35813113.
Bug: 35813113

Change-Id: Id055b225f394ebc2fd3dcafa24edffc7a228df10
diff --git a/EventFlag.cpp b/EventFlag.cpp
index 164e40c..e391ef2 100644
--- a/EventFlag.cpp
+++ b/EventFlag.cpp
@@ -176,6 +176,11 @@
     } else {
         old = std::atomic_fetch_and(mEfWordPtr, ~bitmask);
         *efState = old & bitmask;
+
+        if (*efState == 0) {
+            /* Return -EINTR for a spurious wakeup */
+            status = -EINTR;
+        }
     }
     return status;
 }