Loading libutils/Looper.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <utils/Looper.h> #include <atomic> #include <sys/eventfd.h> #include <cinttypes> Loading Loading @@ -216,13 +217,13 @@ int Looper::pollInner(int timeoutMillis) { mResponseIndex = 0; // We are about to idle. mPolling = true; std::atomic_store_explicit(&mPolling, true, std::memory_order_relaxed); struct epoll_event eventItems[EPOLL_MAX_EVENTS]; int eventCount = epoll_wait(mEpollFd.get(), eventItems, EPOLL_MAX_EVENTS, timeoutMillis); // No longer idling. mPolling = false; std::atomic_store_explicit(&mPolling, false, std::memory_order_relaxed); // Acquire lock. mLock.lock(); Loading Loading @@ -673,7 +674,7 @@ void Looper::removeMessages(const sp<MessageHandler>& handler, int what) { } bool Looper::isPolling() const { return mPolling; return std::atomic_load_explicit(&mPolling, std::memory_order_relaxed); } uint32_t Looper::Request::getEpollEvents() const { Loading libutils/include/utils/Looper.h +2 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <android-base/unique_fd.h> #include <atomic> #include <unordered_map> #include <utility> Loading Loading @@ -479,7 +480,7 @@ private: // Whether we are currently waiting for work. Not protected by a lock, // any use of it is racy anyway. volatile bool mPolling; std::atomic<bool> mPolling; android::base::unique_fd mEpollFd; // guarded by mLock but only modified on the looper thread bool mEpollRebuildRequired; // guarded by mLock Loading Loading
libutils/Looper.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <utils/Looper.h> #include <atomic> #include <sys/eventfd.h> #include <cinttypes> Loading Loading @@ -216,13 +217,13 @@ int Looper::pollInner(int timeoutMillis) { mResponseIndex = 0; // We are about to idle. mPolling = true; std::atomic_store_explicit(&mPolling, true, std::memory_order_relaxed); struct epoll_event eventItems[EPOLL_MAX_EVENTS]; int eventCount = epoll_wait(mEpollFd.get(), eventItems, EPOLL_MAX_EVENTS, timeoutMillis); // No longer idling. mPolling = false; std::atomic_store_explicit(&mPolling, false, std::memory_order_relaxed); // Acquire lock. mLock.lock(); Loading Loading @@ -673,7 +674,7 @@ void Looper::removeMessages(const sp<MessageHandler>& handler, int what) { } bool Looper::isPolling() const { return mPolling; return std::atomic_load_explicit(&mPolling, std::memory_order_relaxed); } uint32_t Looper::Request::getEpollEvents() const { Loading
libutils/include/utils/Looper.h +2 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <android-base/unique_fd.h> #include <atomic> #include <unordered_map> #include <utility> Loading Loading @@ -479,7 +480,7 @@ private: // Whether we are currently waiting for work. Not protected by a lock, // any use of it is racy anyway. volatile bool mPolling; std::atomic<bool> mPolling; android::base::unique_fd mEpollFd; // guarded by mLock but only modified on the looper thread bool mEpollRebuildRequired; // guarded by mLock Loading