summaryrefslogtreecommitdiff
path: root/runtime/gc/task_processor.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2017-11-09 17:18:05 +0000
committer Vladimir Marko <vmarko@google.com> 2017-11-14 11:40:19 +0000
commit103fa6ed700f4efca4ccf17eeef3fef231ceb7b5 (patch)
tree6642f46c648c795bd3f6097e9503bbdba9f9a0fe /runtime/gc/task_processor.h
parentf4580f43bcb74061ba8b7847ec65f2fe160f1751 (diff)
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
Diffstat (limited to 'runtime/gc/task_processor.h')
-rw-r--r--runtime/gc/task_processor.h20
1 files changed, 10 insertions, 10 deletions
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<ConditionVariable> cond_ GUARDED_BY(lock_);
std::multiset<HeapTask*, CompareByTargetRunTime> tasks_ GUARDED_BY(lock_);
Thread* running_thread_ GUARDED_BY(lock_);