diff options
author | 2018-02-13 18:51:55 -0800 | |
---|---|---|
committer | 2018-02-13 18:51:55 -0800 | |
commit | 9cbe4dad35ae986420a3dda164fb602ee6b48923 (patch) | |
tree | 3b3276c34252ed2c637728f0d16c19596376188c | |
parent | a8cbd47495b4bbf8977388d371ae9e3a71652639 (diff) |
SF: Fix an EventThread deadlock
EventThread::removeDisplayEventConnection tried to acquire the mutex,
however the caller (eventThread::threadMain()) already had it.
The fix was to not acquire the mutex, since threadMain() was the only
caller.
Bug: 73256320
Test: Can toggle "Show taps" from dev options without lockup.
Change-Id: I855b19b3d0ac9e0ea05604cc7b077f4a5030a00b
-rw-r--r-- | services/surfaceflinger/EventThread.cpp | 5 | ||||
-rw-r--r-- | services/surfaceflinger/EventThread.h | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp index 90aab506c8..1f4f5a53f4 100644 --- a/services/surfaceflinger/EventThread.cpp +++ b/services/surfaceflinger/EventThread.cpp @@ -100,8 +100,7 @@ status_t EventThread::registerDisplayEventConnection( return NO_ERROR; } -void EventThread::removeDisplayEventConnection(const wp<EventThread::Connection>& connection) { - std::lock_guard<std::mutex> lock(mMutex); +void EventThread::removeDisplayEventConnectionLocked(const wp<EventThread::Connection>& connection) { mDisplayEventConnections.remove(connection); } @@ -195,7 +194,7 @@ void EventThread::threadMain() NO_THREAD_SAFETY_ANALYSIS { // handle any other error on the pipe as fatal. the only // reasonable thing to do is to clean-up this connection. // The most common error we'll get here is -EPIPE. - removeDisplayEventConnection(signalConnections[i]); + removeDisplayEventConnectionLocked(signalConnections[i]); } } } diff --git a/services/surfaceflinger/EventThread.h b/services/surfaceflinger/EventThread.h index 708806a22d..97f0a359e2 100644 --- a/services/surfaceflinger/EventThread.h +++ b/services/surfaceflinger/EventThread.h @@ -129,7 +129,7 @@ private: DisplayEventReceiver::Event* event) REQUIRES(mMutex); - void removeDisplayEventConnection(const wp<Connection>& connection); + void removeDisplayEventConnectionLocked(const wp<Connection>& connection) REQUIRES(mMutex); void enableVSyncLocked() REQUIRES(mMutex); void disableVSyncLocked() REQUIRES(mMutex); |