From 0ac95c40bcac812d1249b53814b94ccda3603cf9 Mon Sep 17 00:00:00 2001 From: Haegeun Park Date: Wed, 4 Jan 2017 11:45:56 +0900 Subject: [PATCH] [Evas GL Thread 1] evas: Fixed indentation of evas_thread_render.c Summary: @fix Change-Id: I411fe6d75dc7b15c0d7f19f165ea4b0cc3b28c12 Reviewers: sung, jpeg, cedric, raster Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4525 --- src/lib/evas/common/evas_thread_render.c | 225 ++++++++++++----------- 1 file changed, 113 insertions(+), 112 deletions(-) diff --git a/src/lib/evas/common/evas_thread_render.c b/src/lib/evas/common/evas_thread_render.c index 03812b5128..85955669ac 100644 --- a/src/lib/evas/common/evas_thread_render.c +++ b/src/lib/evas/common/evas_thread_render.c @@ -63,13 +63,13 @@ out: EAPI void evas_thread_cmd_enqueue(Evas_Thread_Command_Cb cb, void *data) { - evas_thread_queue_append(cb, data, EINA_FALSE); + evas_thread_queue_append(cb, data, EINA_FALSE); } EAPI void evas_thread_queue_flush(Evas_Thread_Command_Cb cb, void *data) { - evas_thread_queue_append(cb, data, EINA_TRUE); + evas_thread_queue_append(cb, data, EINA_TRUE); } static void* @@ -77,160 +77,161 @@ evas_thread_worker_func(void *data EINA_UNUSED, Eina_Thread thread EINA_UNUSED) { eina_thread_name_set(eina_thread_self(), "Eevas-thread-wk"); while (1) - { - Evas_Thread_Command *cmd; - unsigned int len, max; + { + Evas_Thread_Command *cmd; + unsigned int len, max; - eina_lock_take(&evas_thread_queue_lock); + eina_lock_take(&evas_thread_queue_lock); - while (!evas_thread_queue_ready) - { - if (exit_thread) - { - eina_lock_release(&evas_thread_queue_lock); - goto out; - } - eina_condition_wait(&evas_thread_queue_condition); - } + while (!evas_thread_queue_ready) + { + if (exit_thread) + { + eina_lock_release(&evas_thread_queue_lock); + goto out; + } + eina_condition_wait(&evas_thread_queue_condition); + } - if (!eina_inarray_count(&evas_thread_queue)) - { - ERR("Signaled to find an empty queue. BUG!"); - evas_thread_queue_ready = EINA_FALSE; - eina_lock_release(&evas_thread_queue_lock); - continue; - } + if (!eina_inarray_count(&evas_thread_queue)) + { + ERR("Signaled to find an empty queue. BUG!"); + evas_thread_queue_ready = EINA_FALSE; + eina_lock_release(&evas_thread_queue_lock); + continue; + } - cmd = evas_thread_queue.members; - evas_thread_queue.members = evas_thread_queue_cache; - evas_thread_queue_cache = cmd; + cmd = evas_thread_queue.members; + evas_thread_queue.members = evas_thread_queue_cache; + evas_thread_queue_cache = cmd; - max = evas_thread_queue.max; - evas_thread_queue.max = evas_thread_queue_cache_max; - evas_thread_queue_cache_max = max; + max = evas_thread_queue.max; + evas_thread_queue.max = evas_thread_queue_cache_max; + evas_thread_queue_cache_max = max; - len = evas_thread_queue.len; - evas_thread_queue.len = 0; + len = evas_thread_queue.len; + evas_thread_queue.len = 0; - evas_thread_queue_ready = EINA_FALSE; + evas_thread_queue_ready = EINA_FALSE; - eina_lock_release(&evas_thread_queue_lock); + eina_lock_release(&evas_thread_queue_lock); - DBG("Evas render thread command queue length: %u", len); + DBG("Evas render thread command queue length: %u", len); - eina_evlog("+thread", NULL, 0.0, NULL); - while (len) - { - assert(cmd->cb); + eina_evlog("+thread", NULL, 0.0, NULL); + while (len) + { + assert(cmd->cb); - eina_evlog("+thread_do", cmd->data, 0.0, NULL); - cmd->cb(cmd->data); - eina_evlog("-thread_do", cmd->data, 0.0, NULL); + eina_evlog("+thread_do", cmd->data, 0.0, NULL); + cmd->cb(cmd->data); + eina_evlog("-thread_do", cmd->data, 0.0, NULL); - cmd++; - len--; - } - eina_evlog("-thread", NULL, 0.0, NULL); - } + cmd++; + len--; + } + eina_evlog("-thread", NULL, 0.0, NULL); + } out: - /* WRN: add a memory barrier or use a lock if we add more code here */ - evas_thread_exited = 1; - return NULL; + /* WRN: add a memory barrier or use a lock if we add more code here */ + evas_thread_exited = 1; + return NULL; } int evas_thread_init(void) { - if (init_count++) - return init_count; + if (init_count++) + return init_count; - exit_thread = EINA_FALSE; - evas_thread_exited = 0; + exit_thread = EINA_FALSE; + evas_thread_exited = 0; - if(!eina_threads_init()) - { - CRI("Could not init eina threads"); - goto fail_on_eina_thread_init; - } + if(!eina_threads_init()) + { + CRI("Could not init eina threads"); + goto fail_on_eina_thread_init; + } - eina_inarray_step_set(&evas_thread_queue, sizeof (Eina_Inarray), sizeof (Evas_Thread_Command), 128); + eina_inarray_step_set(&evas_thread_queue, sizeof (Eina_Inarray), sizeof (Evas_Thread_Command), 128); - if (!eina_lock_new(&evas_thread_queue_lock)) - { - CRI("Could not create draw thread lock (%m)"); - goto fail_on_lock_creation; - } - if (!eina_condition_new(&evas_thread_queue_condition, &evas_thread_queue_lock)) - { - CRI("Could not create draw thread condition (%m)"); - goto fail_on_cond_creation; - } + if (!eina_lock_new(&evas_thread_queue_lock)) + { + CRI("Could not create draw thread lock (%m)"); + goto fail_on_lock_creation; + } + if (!eina_condition_new(&evas_thread_queue_condition, &evas_thread_queue_lock)) + { + CRI("Could not create draw thread condition (%m)"); + goto fail_on_cond_creation; + } - if (!eina_thread_create(&evas_thread_worker, EINA_THREAD_NORMAL, -1, - evas_thread_worker_func, NULL)) - { - CRI("Could not create draw thread (%m)"); - goto fail_on_thread_creation; - } + if (!eina_thread_create(&evas_thread_worker, EINA_THREAD_NORMAL, -1, + evas_thread_worker_func, NULL)) + { + CRI("Could not create draw thread (%m)"); + goto fail_on_thread_creation; + } - return init_count; + return init_count; fail_on_thread_creation: - evas_thread_worker = 0; - eina_condition_free(&evas_thread_queue_condition); + evas_thread_worker = 0; + eina_condition_free(&evas_thread_queue_condition); fail_on_cond_creation: - eina_lock_free(&evas_thread_queue_lock); + eina_lock_free(&evas_thread_queue_lock); fail_on_lock_creation: - eina_threads_shutdown(); + eina_threads_shutdown(); fail_on_eina_thread_init: - exit_thread = EINA_TRUE; - evas_thread_exited = 1; - return --init_count; + exit_thread = EINA_TRUE; + evas_thread_exited = 1; + return --init_count; } int evas_thread_shutdown(void) { - double to = 0 ; + double to = 0 ; - if (init_count <= 0) - { - ERR("Too many calls to shutdown, ignored."); - return 0; - } + if (init_count <= 0) + { + ERR("Too many calls to shutdown, ignored."); + return 0; + } - if (--init_count) - return init_count; + if (--init_count) + return init_count; - eina_lock_take(&evas_thread_queue_lock); + eina_lock_take(&evas_thread_queue_lock); - exit_thread = EINA_TRUE; - eina_condition_signal(&evas_thread_queue_condition); + exit_thread = EINA_TRUE; + eina_condition_signal(&evas_thread_queue_condition); - eina_lock_release(&evas_thread_queue_lock); - _shutdown_timeout(&to, SHUTDOWN_TIMEOUT_RESET, SHUTDOWN_TIMEOUT); - while (!evas_thread_exited && (evas_async_events_process() != -1)) - { - if(_shutdown_timeout(&to, SHUTDOWN_TIMEOUT_CHECK, SHUTDOWN_TIMEOUT)) - { - CRI("Timeout shutdown thread. Skipping thread_join. Some resources could be leaked"); - goto timeout_shutdown; - } - } + eina_lock_release(&evas_thread_queue_lock); - eina_thread_join(evas_thread_worker); + _shutdown_timeout(&to, SHUTDOWN_TIMEOUT_RESET, SHUTDOWN_TIMEOUT); + while (!evas_thread_exited && (evas_async_events_process() != -1)) + { + if(_shutdown_timeout(&to, SHUTDOWN_TIMEOUT_CHECK, SHUTDOWN_TIMEOUT)) + { + CRI("Timeout shutdown thread. Skipping thread_join. Some resources could be leaked"); + goto timeout_shutdown; + } + } + + eina_thread_join(evas_thread_worker); timeout_shutdown: - eina_lock_free(&evas_thread_queue_lock); - eina_condition_free(&evas_thread_queue_condition); + eina_lock_free(&evas_thread_queue_lock); + eina_condition_free(&evas_thread_queue_condition); - evas_thread_worker = 0; + evas_thread_worker = 0; - free(evas_thread_queue_cache); - evas_thread_queue_cache = NULL; - eina_inarray_flush(&evas_thread_queue); + free(evas_thread_queue_cache); + evas_thread_queue_cache = NULL; + eina_inarray_flush(&evas_thread_queue); - eina_threads_shutdown(); + eina_threads_shutdown(); - return 0; + return 0; }