diff options
author | John Reck <jreck@google.com> | 2015-03-24 12:16:37 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2015-03-24 12:16:37 -0700 |
commit | 815f2a093a4b44863fe9ffdb1986a2d5425ffef8 (patch) | |
tree | 98f304aed59d887ff5ce4702125d96171f972659 /libs/hwui/thread/TaskManager.cpp | |
parent | 1cef4196886b0cc1238111d396c1e3665a5fd2ae (diff) |
Shave 10us off of hwuitask
This prevents an issue where if the signal schedules
hwuiTask it will immediately block and go back to sleep due
to mLock still being held.
This costs 10us in thread scheduling ping-ponging bouncing
between hwuiTask and RenderThread
Change-Id: I47595c1bf5736576483a6aa7aada0b1be1e04268
Diffstat (limited to 'libs/hwui/thread/TaskManager.cpp')
-rw-r--r-- | libs/hwui/thread/TaskManager.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/hwui/thread/TaskManager.cpp b/libs/hwui/thread/TaskManager.cpp index c69b2fd56383..f0ed0bbfedc1 100644 --- a/libs/hwui/thread/TaskManager.cpp +++ b/libs/hwui/thread/TaskManager.cpp @@ -109,8 +109,11 @@ bool TaskManager::WorkerThread::addTask(TaskWrapper task) { return false; } - Mutex::Autolock l(mLock); - ssize_t index = mTasks.add(task); + ssize_t index; + { + Mutex::Autolock l(mLock); + index = mTasks.add(task); + } mSignal.signal(); return index >= 0; |