diff --git a/legacy/evas/src/lib/cache/evas_preload.c b/legacy/evas/src/lib/cache/evas_preload.c index 759d133d3b..1bff5f2c1a 100644 --- a/legacy/evas/src/lib/cache/evas_preload.c +++ b/legacy/evas/src/lib/cache/evas_preload.c @@ -213,13 +213,30 @@ evas_preload_thread_run(void (*func_heavy) (void *data), if (pthread_create(&pth->thread, NULL, (void *) _evas_preload_thread_worker, pth) == 0) { - /* lower priority of async loader threads so they use up "bg cpu" - * as it was really intended to work */ +#ifdef __linux__ struct sched_param param; + /* lower priority of async loader threads so they use up "bg cpu" + * as it was really intended to work. + * yes - this may fail if not root. there is no portable way to do + * this so try - if it fails. meh. nothnig to be done. + */ memset(¶m, 0, sizeof(param)); - param.sched_priority = sched_get_priority_min(SCHED_RR); - pthread_setschedparam(pth->thread, SCHED_RR, ¶m); + param.sched_priority = sched_get_priority_max(SCHED_RR); + if (pthread_setschedparam(pth->thread, SCHED_RR, ¶m) != 0) + { + int newp; + + errno = 0; + newp = getpriority(PRIO_PROCESS, 0); + if (errno == 0) + { + newp += 5; + if (newp > 19) newp = 19; + setpriority(PRIO_PROCESS, pth->thread, newp); + } + } +#endif LKL(_mutex); _evas_preload_thread_count++; diff --git a/legacy/evas/src/lib/include/evas_common.h b/legacy/evas/src/lib/include/evas_common.h index b86498a5b0..7d4b1941d2 100644 --- a/legacy/evas/src/lib/include/evas_common.h +++ b/legacy/evas/src/lib/include/evas_common.h @@ -133,7 +133,13 @@ extern EAPI int _evas_log_dom_global; # include # include -# define LK(x) pthread_mutex_t x +#ifdef __linux__ +# include +# include +# include +#endif + +#define LK(x) pthread_mutex_t x #ifndef EVAS_FRAME_QUEUING # define LKI(x) pthread_mutex_init(&(x), NULL); #else