summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2009-10-11 06:57:23 +0000
committerCarsten Haitzler <raster@rasterman.com>2009-10-11 06:57:23 +0000
commit0a036d1ec24584dc73b1f05a6c8c198772158dd6 (patch)
tree04bef22794bbaa6f0eb304027d52bf706bd2612b /legacy
parent00486440c0c760f8de5bd68abf732b1b56446e08 (diff)
keep locks for less - ie not arorund a loop calling callbacks.
SVN revision: 43014
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/lib/canvas/evas_async_events.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_async_events.c b/legacy/evas/src/lib/canvas/evas_async_events.c
index 57555f426e..5ad94ac653 100644
--- a/legacy/evas/src/lib/canvas/evas_async_events.c
+++ b/legacy/evas/src/lib/canvas/evas_async_events.c
@@ -149,6 +149,9 @@ evas_async_events_process(void)
149 int i; 149 int i;
150 int check; 150 int check;
151 int count = 0; 151 int count = 0;
152 int myqueue_num = 0;
153 int myqueue_alloc = 0;
154 Evas_Event_Async *myqueue = NULL;
152 155
153 if (_fd_read == -1) return 0; 156 if (_fd_read == -1) return 0;
154 157
@@ -161,18 +164,24 @@ evas_async_events_process(void)
161 164
162 if (queue) 165 if (queue)
163 { 166 {
164 for (i = 0; i < queue_num; i++) 167 myqueue_num = queue_num;
168 myqueue_alloc = queue_alloc;
169 myqueue = queue;
170 queue_num = 0;
171 queue_alloc = 0;
172 queue = NULL;
173 pthread_mutex_unlock(&_mutex);
174
175 for (i = 0; i < myqueue_num; i++)
165 { 176 {
166 ev = &(queue[i]); 177 ev = &(myqueue[i]);
167 if (ev->func) ev->func((void *)ev->target, ev->type, ev->event_info); 178 if (ev->func) ev->func((void *)ev->target, ev->type, ev->event_info);
168 count++; 179 count++;
169 } 180 }
170 free(queue); 181 free(myqueue);
171 queue = NULL;
172 queue_num = 0;
173 queue_alloc = 0;
174 } 182 }
175 pthread_mutex_unlock(&_mutex); 183 else
184 pthread_mutex_unlock(&_mutex);
176 185
177 if (check < 0) 186 if (check < 0)
178 switch (errno) 187 switch (errno)
@@ -229,6 +238,7 @@ evas_async_events_put(const void *target, Evas_Callback_Type type, void *event_i
229 { 238 {
230 queue_alloc -= 32; 239 queue_alloc -= 32;
231 queue_num--; 240 queue_num--;
241 pthread_mutex_unlock(&_mutex);
232 return 0; 242 return 0;
233 } 243 }
234 queue = q2; 244 queue = q2;