[problem] Gallery is stuck sometimes if it has so many images.
[cause] Heavy works in resource thread.
[solution] Decrease CPU loads for resource thread using environment variable.
Have DALI_RESOURCE_THREAD_IDLE_PRIORITY set, and idle priority for the resources
will be used.
Change-Id: Iab8b3a5687046831329740429b2ae586dc9ec5cb
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
namespace SlpPlatform
{
+namespace
+{
+const char * const IDLE_PRIORITY_ENVIRONMENT_VARIABLE_NAME = "DALI_RESOURCE_THREAD_IDLE_PRIORITY";
+} // unnamed namespace
+
ResourceThreadBase::ResourceThreadBase(ResourceLoader& resourceLoader)
: mResourceLoader( resourceLoader ), mCurrentRequestId( NO_REQUEST ), mPaused( false )
{
void ResourceThreadBase::ThreadLoop()
{
+ // TODO: Use Environment Options
+ const char* threadPriorityIdleRequired = std::getenv( IDLE_PRIORITY_ENVIRONMENT_VARIABLE_NAME );
+ if( threadPriorityIdleRequired )
+ {
+ // if the parameter exists then set up an idle priority for this thread
+ struct sched_param sp;
+ sp.sched_priority = 0;
+ sched_setscheduler(0, SCHED_IDLE, &sp);
+ }
+
InstallLogging();
while( !mResourceLoader.IsTerminating() )