diff options
Diffstat (limited to 'libs/hwui/thread')
| -rw-r--r-- | libs/hwui/thread/TaskManager.cpp | 12 | ||||
| -rw-r--r-- | libs/hwui/thread/TaskProcessor.h | 8 |
2 files changed, 5 insertions, 15 deletions
diff --git a/libs/hwui/thread/TaskManager.cpp b/libs/hwui/thread/TaskManager.cpp index cb5401c..c69b2fd 100644 --- a/libs/hwui/thread/TaskManager.cpp +++ b/libs/hwui/thread/TaskManager.cpp @@ -14,10 +14,8 @@ * limitations under the License. */ -#include <sys/sysinfo.h> -#if defined(HAVE_PTHREADS) #include <sys/resource.h> -#endif +#include <sys/sysinfo.h> #include "TaskManager.h" #include "Task.h" @@ -83,9 +81,7 @@ bool TaskManager::addTaskBase(const sp<TaskBase>& task, const sp<TaskProcessorBa /////////////////////////////////////////////////////////////////////////////// status_t TaskManager::WorkerThread::readyToRun() { -#if defined(HAVE_PTHREADS) setpriority(PRIO_PROCESS, 0, PRIORITY_FOREGROUND); -#endif return NO_ERROR; } @@ -109,6 +105,8 @@ bool TaskManager::WorkerThread::threadLoop() { bool TaskManager::WorkerThread::addTask(TaskWrapper task) { if (!isRunning()) { run(mName.string(), PRIORITY_DEFAULT); + } else if (exitPending()) { + return false; } Mutex::Autolock l(mLock); @@ -124,10 +122,6 @@ size_t TaskManager::WorkerThread::getTaskCount() const { } void TaskManager::WorkerThread::exit() { - { - Mutex::Autolock l(mLock); - mTasks.clear(); - } requestExit(); mSignal.signal(); } diff --git a/libs/hwui/thread/TaskProcessor.h b/libs/hwui/thread/TaskProcessor.h index d1269f0..30b3719 100644 --- a/libs/hwui/thread/TaskProcessor.h +++ b/libs/hwui/thread/TaskProcessor.h @@ -30,9 +30,6 @@ public: TaskProcessorBase() { } virtual ~TaskProcessorBase() { }; -private: - friend class TaskManager; - virtual void process(const sp<TaskBase>& task) = 0; }; @@ -44,9 +41,6 @@ public: bool add(const sp<Task<T> >& task); - virtual void onProcess(const sp<Task<T> >& task) = 0; - -private: virtual void process(const sp<TaskBase>& task) { sp<Task<T> > realTask = static_cast<Task<T>* >(task.get()); // This is the right way to do it but sp<> doesn't play nice @@ -54,6 +48,8 @@ private: onProcess(realTask); } + virtual void onProcess(const sp<Task<T> >& task) = 0; + TaskManager* mManager; }; |
