if (!pth->p) goto on_error;
if (pthread_create(&pth->thread, NULL, (void *) _ecore_thread_worker, pth) == 0)
- return (Ecore_Thread *) work;
+ {
+ /* lower priority of worker threads so they use up "bg cpu"
+ * as it was really intended to work */
+ struct sched_param param;
+
+ memset(¶m, 0, sizeof(param));
+ param.sched_priority = sched_get_priority_min(SCHED_RR);
+ pthread_setschedparam(pth->thread, SCHED_RR, ¶m);
+
+ return (Ecore_Thread *) work;
+ }
on_error:
if (pth)
pthread_t t;
if (pthread_create(&t, NULL, (void *) _ecore_direct_worker, worker) == 0)
- return (Ecore_Thread *) worker;
+ {
+ /* lower priority of worker threads so they use up "bg cpu"
+ * as it was really intended to work */
+ struct sched_param param;
+
+ memset(¶m, 0, sizeof(param));
+ param.sched_priority = sched_get_priority_min(SCHED_RR);
+ pthread_setschedparam(t, SCHED_RR, ¶m);
+
+ return (Ecore_Thread *) worker;
+ }
}
pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
if (pth->p) goto on_error;
if (pthread_create(&pth->thread, NULL, (void *) _ecore_thread_worker, pth) == 0)
- return (Ecore_Thread *) worker;
+ {
+ /* lower priority of worker threads so they use up "bg cpu"
+ * as it was really intended to work */
+ struct sched_param param;
+
+ memset(¶m, 0, sizeof(param));
+ param.sched_priority = sched_get_priority_min(SCHED_RR);
+ pthread_setschedparam(pth->thread, SCHED_RR, ¶m);
+
+ return (Ecore_Thread *) worker;
+ }
on_error:
if (pth)