From 103fa6ed700f4efca4ccf17eeef3fef231ceb7b5 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 9 Nov 2017 17:18:05 +0000 Subject: ART: Destroy unprocessed tasks in TaskProcessor. In the past I've seen valgrind complain about leaked tasks in the TaskProcessor, so make sure we clean up properly. Also hold the mutex and condition variable directly in the object instead of allocating separate objects on the heap. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: If0d4ac39bf3d8e2aa9b465186d4fa7c3cb746718 --- runtime/gc/task_processor.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'runtime/gc/task_processor.h') diff --git a/runtime/gc/task_processor.h b/runtime/gc/task_processor.h index e40fa06319..f6b5607037 100644 --- a/runtime/gc/task_processor.h +++ b/runtime/gc/task_processor.h @@ -54,17 +54,17 @@ class TaskProcessor { public: TaskProcessor(); virtual ~TaskProcessor(); - void AddTask(Thread* self, HeapTask* task) REQUIRES(!*lock_); - HeapTask* GetTask(Thread* self) REQUIRES(!*lock_); - void Start(Thread* self) REQUIRES(!*lock_); + void AddTask(Thread* self, HeapTask* task) REQUIRES(!lock_); + HeapTask* GetTask(Thread* self) REQUIRES(!lock_); + void Start(Thread* self) REQUIRES(!lock_); // Stop tells the RunAllTasks to finish up the remaining tasks as soon as // possible then return. - void Stop(Thread* self) REQUIRES(!*lock_); - void RunAllTasks(Thread* self) REQUIRES(!*lock_); - bool IsRunning() const REQUIRES(!*lock_); + void Stop(Thread* self) REQUIRES(!lock_); + void RunAllTasks(Thread* self) REQUIRES(!lock_); + bool IsRunning() const REQUIRES(!lock_); void UpdateTargetRunTime(Thread* self, HeapTask* target_time, uint64_t new_target_time) - REQUIRES(!*lock_); - Thread* GetRunningThread() const REQUIRES(!*lock_); + REQUIRES(!lock_); + Thread* GetRunningThread() const REQUIRES(!lock_); private: class CompareByTargetRunTime { @@ -74,9 +74,9 @@ class TaskProcessor { } }; - mutable Mutex* lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; + mutable Mutex lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; + ConditionVariable cond_ GUARDED_BY(lock_); bool is_running_ GUARDED_BY(lock_); - std::unique_ptr cond_ GUARDED_BY(lock_); std::multiset tasks_ GUARDED_BY(lock_); Thread* running_thread_ GUARDED_BY(lock_); -- cgit v1.2.3-59-g8ed1b