summaryrefslogtreecommitdiffstats
path: root/libs/hwui/thread/TaskManager.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-03-24 12:16:37 -0700
committerJohn Reck <jreck@google.com>2015-03-24 12:16:37 -0700
commit815f2a093a4b44863fe9ffdb1986a2d5425ffef8 (patch)
tree98f304aed59d887ff5ce4702125d96171f972659 /libs/hwui/thread/TaskManager.cpp
parent1cef4196886b0cc1238111d396c1e3665a5fd2ae (diff)
downloadframeworks_base-815f2a093a4b44863fe9ffdb1986a2d5425ffef8.zip
frameworks_base-815f2a093a4b44863fe9ffdb1986a2d5425ffef8.tar.gz
frameworks_base-815f2a093a4b44863fe9ffdb1986a2d5425ffef8.tar.bz2
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.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/hwui/thread/TaskManager.cpp b/libs/hwui/thread/TaskManager.cpp
index c69b2fd..f0ed0bb 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;