audiohal: Check for EINTR and retry when waiting for EventFlag
EINTR can be returned in the case when a futex wait has been
interrupted by a signal. We need to retry in that case.
Bug: 35813113
Change-Id: I7eaee5298f5c0bc5cd62309c3fd8349ee3eae629
Test: make
(cherry picked from commit d2ae9cd57cfbb6f2f4dd0a91dbc7ea2e9e5fc447)
diff --git a/media/libaudiohal/EffectHalHidl.cpp b/media/libaudiohal/EffectHalHidl.cpp
index db115ef..539558d 100644
--- a/media/libaudiohal/EffectHalHidl.cpp
+++ b/media/libaudiohal/EffectHalHidl.cpp
@@ -194,8 +194,8 @@
}
return analyzeResult(retval);
}
- if (ret == -EAGAIN) {
- // This normally retries no more than once.
+ if (ret == -EAGAIN || ret == -EINTR) {
+ // Spurious wakeup. This normally retries no more than once.
goto retry;
}
return ret;
diff --git a/media/libaudiohal/StreamHalHidl.cpp b/media/libaudiohal/StreamHalHidl.cpp
index 77ba716..5b06b73 100644
--- a/media/libaudiohal/StreamHalHidl.cpp
+++ b/media/libaudiohal/StreamHalHidl.cpp
@@ -360,8 +360,8 @@
}
return ret;
}
- if (ret == -EAGAIN) {
- // This normally retries no more than once.
+ if (ret == -EAGAIN || ret == -EINTR) {
+ // Spurious wakeup. This normally retries no more than once.
goto retry;
}
return ret;
@@ -620,8 +620,8 @@
}
return ret;
}
- if (ret == -EAGAIN) {
- // This normally retries no more than once.
+ if (ret == -EAGAIN || ret == -EINTR) {
+ // Spurious wakeup. This normally retries no more than once.
goto retry;
}
return ret;