summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_async_events.c
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-10-10 17:44:24 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-10-11 11:08:17 +0900
commit6dcffec491f2281dd8649f1196f576fa715507f3 (patch)
treeecaf3025222b4bb48d457285e605465bec57c0a5 /src/lib/evas/canvas/evas_async_events.c
parent12d34309c7c6e3f3041ee576afe93f9ca335059e (diff)
evas: Use Eina_Spinlock for Evas_Scalecache, Evas_Async_Events and Image_Entry.
Diffstat (limited to 'src/lib/evas/canvas/evas_async_events.c')
-rw-r--r--src/lib/evas/canvas/evas_async_events.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/evas/canvas/evas_async_events.c b/src/lib/evas/canvas/evas_async_events.c
index dd3c593..0990ec8 100644
--- a/src/lib/evas/canvas/evas_async_events.c
+++ b/src/lib/evas/canvas/evas_async_events.c
@@ -37,7 +37,7 @@ static Eina_Condition _thread_feedback_cond;
37 37
38static int _thread_loop = 0; 38static int _thread_loop = 0;
39 39
40static Eina_Lock _thread_id_lock; 40static Eina_Spinlock _thread_id_lock;
41static int _thread_id = -1; 41static int _thread_id = -1;
42static int _thread_id_max = 0; 42static int _thread_id_max = 0;
43static int _thread_id_update = 0; 43static int _thread_id_update = 0;
@@ -46,7 +46,7 @@ static int _fd_write = -1;
46static int _fd_read = -1; 46static int _fd_read = -1;
47static pid_t _fd_pid = 0; 47static pid_t _fd_pid = 0;
48 48
49static Eina_Lock async_lock; 49static Eina_Spinlock async_lock;
50static Eina_Inarray async_queue; 50static Eina_Inarray async_queue;
51static Evas_Event_Async *async_queue_cache = NULL; 51static Evas_Event_Async *async_queue_cache = NULL;
52static unsigned int async_queue_cache_max = 0; 52static unsigned int async_queue_cache_max = 0;
@@ -99,7 +99,7 @@ evas_async_events_init(void)
99 fcntl(_fd_read, F_SETFL, O_NONBLOCK); 99 fcntl(_fd_read, F_SETFL, O_NONBLOCK);
100#endif 100#endif
101 101
102 eina_lock_new(&async_lock); 102 eina_spinlock_new(&async_lock);
103 eina_inarray_step_set(&async_queue, sizeof (Eina_Inarray), sizeof (Evas_Event_Async), 16); 103 eina_inarray_step_set(&async_queue, sizeof (Eina_Inarray), sizeof (Evas_Event_Async), 16);
104 104
105 eina_lock_new(&_thread_mutex); 105 eina_lock_new(&_thread_mutex);
@@ -108,7 +108,7 @@ evas_async_events_init(void)
108 eina_lock_new(&_thread_feedback_mutex); 108 eina_lock_new(&_thread_feedback_mutex);
109 eina_condition_new(&_thread_feedback_cond, &_thread_feedback_mutex); 109 eina_condition_new(&_thread_feedback_cond, &_thread_feedback_mutex);
110 110
111 eina_lock_new(&_thread_id_lock); 111 eina_spinlock_new(&_thread_id_lock);
112 112
113 return _init_evas_event; 113 return _init_evas_event;
114} 114}
@@ -123,9 +123,9 @@ evas_async_events_shutdown(void)
123 eina_lock_free(&_thread_mutex); 123 eina_lock_free(&_thread_mutex);
124 eina_condition_free(&_thread_feedback_cond); 124 eina_condition_free(&_thread_feedback_cond);
125 eina_lock_free(&_thread_feedback_mutex); 125 eina_lock_free(&_thread_feedback_mutex);
126 eina_lock_free(&_thread_id_lock); 126 eina_spinlock_free(&_thread_id_lock);
127 127
128 eina_lock_free(&async_lock); 128 eina_spinlock_free(&async_lock);
129 eina_inarray_flush(&async_queue); 129 eina_inarray_flush(&async_queue);
130 free(async_queue_cache); 130 free(async_queue_cache);
131 131
@@ -180,7 +180,7 @@ _evas_async_events_process_single(void)
180 unsigned int len, max; 180 unsigned int len, max;
181 int nr; 181 int nr;
182 182
183 eina_lock_take(&async_lock); 183 eina_spinlock_take(&async_lock);
184 184
185 ev = async_queue.members; 185 ev = async_queue.members;
186 async_queue.members = async_queue_cache; 186 async_queue.members = async_queue_cache;
@@ -193,7 +193,7 @@ _evas_async_events_process_single(void)
193 len = async_queue.len; 193 len = async_queue.len;
194 async_queue.len = 0; 194 async_queue.len = 0;
195 195
196 eina_lock_release(&async_lock); 196 eina_spinlock_release(&async_lock);
197 197
198 DBG("Evas async events queue length: %u", len); 198 DBG("Evas async events queue length: %u", len);
199 nr = len; 199 nr = len;
@@ -269,13 +269,13 @@ evas_async_events_put(const void *target, Evas_Callback_Type type, void *event_i
269 269
270 _evas_async_events_fork_handle(); 270 _evas_async_events_fork_handle();
271 271
272 eina_lock_take(&async_lock); 272 eina_spinlock_take(&async_lock);
273 273
274 count = async_queue.len; 274 count = async_queue.len;
275 ev = eina_inarray_grow(&async_queue, 1); 275 ev = eina_inarray_grow(&async_queue, 1);
276 if (!ev) 276 if (!ev)
277 { 277 {
278 eina_lock_release(&async_lock); 278 eina_spinlock_release(&async_lock);
279 return EINA_FALSE; 279 return EINA_FALSE;
280 } 280 }
281 281
@@ -284,7 +284,7 @@ evas_async_events_put(const void *target, Evas_Callback_Type type, void *event_i
284 ev->type = type; 284 ev->type = type;
285 ev->event_info = event_info; 285 ev->event_info = event_info;
286 286
287 eina_lock_release(&async_lock); 287 eina_spinlock_release(&async_lock);
288 288
289 if (count == 0) 289 if (count == 0)
290 { 290 {
@@ -365,14 +365,14 @@ evas_thread_main_loop_begin(void)
365 order = malloc(sizeof (Evas_Safe_Call)); 365 order = malloc(sizeof (Evas_Safe_Call));
366 if (!order) return -1; 366 if (!order) return -1;
367 367
368 eina_lock_take(&_thread_id_lock); 368 eina_spinlock_take(&_thread_id_lock);
369 order->current_id = ++_thread_id_max; 369 order->current_id = ++_thread_id_max;
370 if (order->current_id < 0) 370 if (order->current_id < 0)
371 { 371 {
372 _thread_id_max = 0; 372 _thread_id_max = 0;
373 order->current_id = ++_thread_id_max; 373 order->current_id = ++_thread_id_max;
374 } 374 }
375 eina_lock_release(&_thread_id_lock); 375 eina_spinlock_release(&_thread_id_lock);
376 376
377 eina_lock_new(&order->m); 377 eina_lock_new(&order->m);
378 eina_condition_new(&order->c, &order->m); 378 eina_condition_new(&order->c, &order->m);