Make wake() error fatal
If wake() fails to write to mWakeEventFd, the looper is
screwed. This is really a fatal, unrecoverable error,
so treat it as such.
This is possibly an explaination for the unexplained
random ANRs
Change-Id: I5af3e013493b475d8e902d8ee6340f331e5d86c8
diff --git a/libutils/Looper.cpp b/libutils/Looper.cpp
index 952c992..254cd8d 100644
--- a/libutils/Looper.cpp
+++ b/libutils/Looper.cpp
@@ -84,6 +84,7 @@
Looper::~Looper() {
close(mWakeEventFd);
+ mWakeEventFd = -1;
if (mEpollFd >= 0) {
close(mEpollFd);
}
@@ -413,7 +414,8 @@
ssize_t nWrite = TEMP_FAILURE_RETRY(write(mWakeEventFd, &inc, sizeof(uint64_t)));
if (nWrite != sizeof(uint64_t)) {
if (errno != EAGAIN) {
- ALOGW("Could not write wake signal: %s", strerror(errno));
+ LOG_ALWAYS_FATAL("Could not write wake signal to fd %d: %s",
+ mWakeEventFd, strerror(errno));
}
}
}