forked from enlightenment/efl
make priority of thread drop linux only - fallback.
SVN revision: 51886
This commit is contained in:
parent
9049befccf
commit
360fb6511a
|
@ -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++;
|
||||
|
|
|
@ -133,7 +133,13 @@ extern EAPI int _evas_log_dom_global;
|
|||
|
||||
# include <pthread.h>
|
||||
# include <sched.h>
|
||||
# define LK(x) pthread_mutex_t x
|
||||
#ifdef __linux__
|
||||
# include <sys/time.h>
|
||||
# include <sys/resource.h>
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#define LK(x) pthread_mutex_t x
|
||||
#ifndef EVAS_FRAME_QUEUING
|
||||
# define LKI(x) pthread_mutex_init(&(x), NULL);
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue