summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/ecore/ecore_thread.c3
-rw-r--r--src/lib/eina/eina_thread.c40
2 files changed, 38 insertions, 5 deletions
diff --git a/src/lib/ecore/ecore_thread.c b/src/lib/ecore/ecore_thread.c
index 05ab26cdea..f38c7880c1 100644
--- a/src/lib/ecore/ecore_thread.c
+++ b/src/lib/ecore/ecore_thread.c
@@ -40,6 +40,7 @@
40# define PHE(x, y) eina_thread_equal(x, y) 40# define PHE(x, y) eina_thread_equal(x, y)
41# define PHS() eina_thread_self() 41# define PHS() eina_thread_self()
42# define PHC(x, f, d) eina_thread_create(&(x), EINA_THREAD_BACKGROUND, -1, (void *)f, d) 42# define PHC(x, f, d) eina_thread_create(&(x), EINA_THREAD_BACKGROUND, -1, (void *)f, d)
43# define PHC2(x, f, d)eina_thread_create(&(x), EINA_THREAD_URGENT, -1, (void *)f, d)
43# define PHJ(x) eina_thread_join(x) 44# define PHJ(x) eina_thread_join(x)
44 45
45typedef struct _Ecore_Pthread_Worker Ecore_Pthread_Worker; 46typedef struct _Ecore_Pthread_Worker Ecore_Pthread_Worker;
@@ -953,7 +954,7 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
953 eina_threads_init(); 954 eina_threads_init();
954 955
955retry_direct: 956retry_direct:
956 if (PHC(t, _ecore_direct_worker, worker)) 957 if (PHC2(t, _ecore_direct_worker, worker))
957 { 958 {
958 SLKL(_ecore_pending_job_threads_mutex); 959 SLKL(_ecore_pending_job_threads_mutex);
959 _ecore_thread_count_no_queue++; 960 _ecore_thread_count_no_queue++;
diff --git a/src/lib/eina/eina_thread.c b/src/lib/eina/eina_thread.c
index c1a1ef0d22..c2bb041f24 100644
--- a/src/lib/eina/eina_thread.c
+++ b/src/lib/eina/eina_thread.c
@@ -141,11 +141,43 @@ _eina_internal_call(void *context)
141 141
142 EINA_THREAD_CLEANUP_PUSH(free, c); 142 EINA_THREAD_CLEANUP_PUSH(free, c);
143 143
144 if (c->prio == EINA_THREAD_BACKGROUND ||
145 c->prio == EINA_THREAD_IDLE)
146 eina_sched_prio_drop();
147
148 self = pthread_self(); 144 self = pthread_self();
145
146 if (c->prio == EINA_THREAD_IDLE)
147 {
148 struct sched_param params;
149 int min;
150
151 min = sched_get_priority_min(SCHED_IDLE);
152 params.sched_priority = min;
153 pthread_setschedparam(self, SCHED_IDLE, &params);
154 }
155 else if (c->prio == EINA_THREAD_BACKGROUND)
156 {
157 struct sched_param params;
158 int min, max;
159
160 min = sched_get_priority_min(SCHED_BATCH);
161 max = sched_get_priority_max(SCHED_BATCH);
162 params.sched_priority = (max - min) / 2;
163 pthread_setschedparam(self, SCHED_BATCH, &params);
164 }
165// do nothing for normal
166// else if (c->prio == EINA_THREAD_NORMAL)
167// {
168// }
169 else if (c->prio == EINA_THREAD_URGENT)
170 {
171 struct sched_param params;
172 int max, pol;
173
174 pthread_getschedparam(self, &pol, &params);
175 max = sched_get_priority_max(pol);
176 params.sched_priority += 5;
177 if (params.sched_priority > max) params.sched_priority = max;
178 pthread_setschedparam(self, pol, &params);
179 }
180
149 _eina_debug_thread_add(&self); 181 _eina_debug_thread_add(&self);
150 EINA_THREAD_CLEANUP_PUSH(_eina_debug_thread_del, &self); 182 EINA_THREAD_CLEANUP_PUSH(_eina_debug_thread_del, &self);
151 r = c->func((void*) c->data, eina_thread_self()); 183 r = c->func((void*) c->data, eina_thread_self());