Merge "Retry on signal." into sc-dev am: 5fcb94848d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15132638

Change-Id: I2071595682b3a69f3b2eb454c2b49cb797ad67c2
This commit is contained in:
TreeHugger Robot
2021-06-29 02:31:47 +00:00
committed by Automerger Merge Worker

View File

@@ -133,8 +133,12 @@ static bool sendRequest(int fd, RequestType requestType, FileIdx fileIdx = -1,
static int waitForDataOrSignal(int fd, int event_fd) {
struct pollfd pfds[2] = {{fd, POLLIN, 0}, {event_fd, POLLIN, 0}};
// Wait indefinitely until either data is ready or stop signal is received
// Wait until either data is ready or stop signal is received
int res = poll(pfds, 2, PollTimeoutMs);
if (res == -1 && errno == EINTR) {
// Treat it the same as timeout and allow the caller to retry.
return 0;
}
if (res <= 0) {
return res;
}