Merge "libutils: Looper add 'repoll'" into main
This commit is contained in:
commit
5ae7d86c64
4 changed files with 5516 additions and 758 deletions
|
|
@ -532,6 +532,30 @@ int Looper::removeFd(int fd) {
|
|||
return removeSequenceNumberLocked(it->second);
|
||||
}
|
||||
|
||||
int Looper::repoll(int fd) {
|
||||
AutoMutex _l(mLock);
|
||||
const auto& it = mSequenceNumberByFd.find(fd);
|
||||
if (it == mSequenceNumberByFd.end()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const auto& request_it = mRequests.find(it->second);
|
||||
if (request_it == mRequests.end()) {
|
||||
return 0;
|
||||
}
|
||||
const auto& [seq, request] = *request_it;
|
||||
|
||||
LOG_ALWAYS_FATAL_IF(
|
||||
fd != request.fd,
|
||||
"Looper has inconsistent data structure. When looking up FD %d found FD %d.", fd,
|
||||
request_it->second.fd);
|
||||
|
||||
epoll_event eventItem = createEpollEvent(request.getEpollEvents(), seq);
|
||||
if (epoll_ctl(mEpollFd.get(), EPOLL_CTL_MOD, fd, &eventItem) == -1) return 0;
|
||||
|
||||
return 1; // success
|
||||
}
|
||||
|
||||
int Looper::removeSequenceNumberLocked(SequenceNumber seq) {
|
||||
#if DEBUG_CALLBACKS
|
||||
ALOGD("%p ~ removeFd - seq=%" PRIu64, this, seq);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -344,6 +344,18 @@ public:
|
|||
*/
|
||||
int removeFd(int fd);
|
||||
|
||||
/**
|
||||
* Tell the kernel to check for the same events we're already checking for
|
||||
* with this FD. This is to be used when there is a kernel driver bug where
|
||||
* the kernel does not properly mark itself as having new data available, in
|
||||
* order to force "fd_op->poll()" to be called. You probably don't want to
|
||||
* use this in general, and you shouldn't use it unless there is a plan to
|
||||
* fix the kernel. See also b/296817256.
|
||||
*
|
||||
* Returns 1 if successfully repolled, 0 if not.
|
||||
*/
|
||||
int repoll(int fd);
|
||||
|
||||
/**
|
||||
* Enqueues a message to be processed by the specified handler.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue