From 8ad0010d6e3ce416cd8148a458d7457c1e59e770 Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Thu, 4 Jun 2009 14:35:01 -0700 Subject: [PATCH] Set the RS thread priority. --- libs/rs/rsContext.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index abc5f456f8eaa..c915c56a72460 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -179,7 +179,20 @@ Context::Context(Device *dev, Surface *sur) gCon = this; LOGE("CC 2"); - int status = pthread_create(&mThreadId, NULL, threadProc, this); + int status; + pthread_attr_t threadAttr; + + status = pthread_attr_init(&threadAttr); + if (status) { + LOGE("Failed to init thread attribute."); + return; + } + + sched_param sparam; + sparam.sched_priority = ANDROID_PRIORITY_DISPLAY; + pthread_attr_setschedparam(&threadAttr, &sparam); + + status = pthread_create(&mThreadId, &threadAttr, threadProc, this); if (status) { LOGE("Failed to start rs context thread."); } @@ -191,8 +204,7 @@ Context::Context(Device *dev, Surface *sur) } LOGE("CC 4"); - - + pthread_attr_destroy(&threadAttr); } Context::~Context()