Lower JIT thread priority
Modify the JIT thread to run at a lower priority in order to allow
UI-critical threads to get enough CPU time.
Bug: 27417985
(cherry picked from commit e701f088f8fe3a2c1f16e2895402f26283f4bcc7)
Change-Id: I5b962a7970ae81dac9e01a8011128c538cd78e40
diff --git a/runtime/thread_pool.h b/runtime/thread_pool.h
index 6cd4ad3..b6c6f02 100644
--- a/runtime/thread_pool.h
+++ b/runtime/thread_pool.h
@@ -59,6 +59,9 @@
virtual ~ThreadPoolWorker();
+ // Set the "nice" priorty for this worker.
+ void SetPthreadPriority(int priority);
+
protected:
ThreadPoolWorker(ThreadPool* thread_pool, const std::string& name, size_t stack_size);
static void* Callback(void* arg) REQUIRES(!Locks::mutator_lock_);
@@ -111,6 +114,9 @@
// thread count of the thread pool.
void SetMaxActiveWorkers(size_t threads) REQUIRES(!task_queue_lock_);
+ // Set the "nice" priorty for threads in the pool.
+ void SetPthreadPriority(int priority);
+
protected:
// get a task to run, blocks if there are no tasks left
virtual Task* GetTask(Thread* self) REQUIRES(!task_queue_lock_);