summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunEon Park <chuneon.park@samsung.com>2013-02-25 16:24:08 +0900
committerChunEon Park <chuneon.park@samsung.com>2013-02-25 16:24:08 +0900
commit0920a8e182d022f0b7b527ce657265deae4580bd (patch)
treed4fd566656736146eeaddded867d6dca859a09e4
parent53fa4cd2d8603b8f9aa8e8597e0b73144b301181 (diff)
evas/cache - formatting
-rw-r--r--src/lib/evas/cache/evas_preload.c74
1 files changed, 34 insertions, 40 deletions
diff --git a/src/lib/evas/cache/evas_preload.c b/src/lib/evas/cache/evas_preload.c
index 6be56eee23..4ff103b7c8 100644
--- a/src/lib/evas/cache/evas_preload.c
+++ b/src/lib/evas/cache/evas_preload.c
@@ -56,7 +56,7 @@ _evas_preload_thread_done(void *target EINA_UNUSED, Evas_Callback_Type type EINA
56 Evas_Preload_Pthread_Worker *work = event_info; 56 Evas_Preload_Pthread_Worker *work = event_info;
57 if (work->cancel) 57 if (work->cancel)
58 { 58 {
59 if (work->func_cancel) work->func_cancel(work->data); 59 if (work->func_cancel) work->func_cancel(work->data);
60 } 60 }
61 else 61 else
62 work->func_end(work->data); 62 work->func_end(work->data);
@@ -73,28 +73,26 @@ _evas_preload_thread_worker(void *data, Eina_Thread thread EINA_UNUSED)
73on_error: 73on_error:
74 for (;;) 74 for (;;)
75 { 75 {
76 LKL(_mutex); 76 LKL(_mutex);
77 if (!_workers) 77 if (!_workers)
78 { 78 {
79 LKU(_mutex); 79 LKU(_mutex);
80 break; 80 break;
81 } 81 }
82 82
83 work = _workers; 83 work = _workers;
84 _workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers), 84 _workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers), EINA_INLIST_GET(_workers)), Evas_Preload_Pthread_Worker);
85 EINA_INLIST_GET(_workers)), 85 LKU(_mutex);
86 Evas_Preload_Pthread_Worker); 86
87 LKU(_mutex); 87 if (work->func_heavy) work->func_heavy(work->data);
88 88 evas_async_events_put(pth, 0, work, _evas_preload_thread_done);
89 if (work->func_heavy) work->func_heavy(work->data);
90 evas_async_events_put(pth, 0, work, _evas_preload_thread_done);
91 } 89 }
92 90
93 LKL(_mutex); 91 LKL(_mutex);
94 if (_workers) 92 if (_workers)
95 { 93 {
96 LKU(_mutex); 94 LKU(_mutex);
97 goto on_error; 95 goto on_error;
98 } 96 }
99 _threads_count--; 97 _threads_count--;
100 LKU(_mutex); 98 LKU(_mutex);
@@ -134,11 +132,9 @@ _evas_preload_thread_shutdown(void)
134 while (_workers) 132 while (_workers)
135 { 133 {
136 work = _workers; 134 work = _workers;
137 _workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers), 135 _workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers), EINA_INLIST_GET(_workers)), Evas_Preload_Pthread_Worker);
138 EINA_INLIST_GET(_workers)),
139 Evas_Preload_Pthread_Worker);
140 if (work->func_cancel) work->func_cancel(work->data); 136 if (work->func_cancel) work->func_cancel(work->data);
141 free(work); 137 free(work);
142 } 138 }
143 LKU(_mutex); 139 LKU(_mutex);
144 140
@@ -147,9 +143,9 @@ _evas_preload_thread_shutdown(void)
147 143
148Evas_Preload_Pthread * 144Evas_Preload_Pthread *
149evas_preload_thread_run(void (*func_heavy) (void *data), 145evas_preload_thread_run(void (*func_heavy) (void *data),
150 void (*func_end) (void *data), 146 void (*func_end) (void *data),
151 void (*func_cancel) (void *data), 147 void (*func_cancel) (void *data),
152 const void *data) 148 const void *data)
153{ 149{
154 Evas_Preload_Pthread_Worker *work; 150 Evas_Preload_Pthread_Worker *work;
155 Evas_Preload_Pthread_Data *pth; 151 Evas_Preload_Pthread_Data *pth;
@@ -157,8 +153,8 @@ evas_preload_thread_run(void (*func_heavy) (void *data),
157 work = malloc(sizeof(Evas_Preload_Pthread_Worker)); 153 work = malloc(sizeof(Evas_Preload_Pthread_Worker));
158 if (!work) 154 if (!work)
159 { 155 {
160 func_cancel((void *)data); 156 func_cancel((void *)data);
161 return NULL; 157 return NULL;
162 } 158 }
163 159
164 work->func_heavy = func_heavy; 160 work->func_heavy = func_heavy;
@@ -171,8 +167,8 @@ evas_preload_thread_run(void (*func_heavy) (void *data),
171 _workers = (Evas_Preload_Pthread_Worker *)eina_inlist_append(EINA_INLIST_GET(_workers), EINA_INLIST_GET(work)); 167 _workers = (Evas_Preload_Pthread_Worker *)eina_inlist_append(EINA_INLIST_GET(_workers), EINA_INLIST_GET(work));
172 if (_threads_count == _threads_max) 168 if (_threads_count == _threads_max)
173 { 169 {
174 LKU(_mutex); 170 LKU(_mutex);
175 return (Evas_Preload_Pthread *)work; 171 return (Evas_Preload_Pthread *)work;
176 } 172 }
177 LKU(_mutex); 173 LKU(_mutex);
178 174
@@ -184,21 +180,21 @@ evas_preload_thread_run(void (*func_heavy) (void *data),
184 180
185 if (eina_thread_create(&pth->thread, EINA_THREAD_BACKGROUND, -1, _evas_preload_thread_worker, pth)) 181 if (eina_thread_create(&pth->thread, EINA_THREAD_BACKGROUND, -1, _evas_preload_thread_worker, pth))
186 { 182 {
187 LKL(_mutex); 183 LKL(_mutex);
188 _threads_count++; 184 _threads_count++;
189 LKU(_mutex); 185 LKU(_mutex);
190 return (Evas_Preload_Pthread*)work; 186 return (Evas_Preload_Pthread*)work;
191 } 187 }
192 188
193 eina_threads_shutdown(); 189 eina_threads_shutdown();
194 190
195 on_error: 191on_error:
196 LKL(_mutex); 192 LKL(_mutex);
197 if (_threads_count == 0) 193 if (_threads_count == 0)
198 { 194 {
199 LKU(_mutex); 195 LKU(_mutex);
200 if (work->func_cancel) work->func_cancel(work->data); 196 if (work->func_cancel) work->func_cancel(work->data);
201 free(work); 197 free(work);
202 return NULL; 198 return NULL;
203 } 199 }
204 LKU(_mutex); 200 LKU(_mutex);
@@ -216,9 +212,7 @@ evas_preload_thread_cancel(Evas_Preload_Pthread *thread)
216 { 212 {
217 if (work == (Evas_Preload_Pthread_Worker *)thread) 213 if (work == (Evas_Preload_Pthread_Worker *)thread)
218 { 214 {
219 _workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers), 215 _workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers), EINA_INLIST_GET(work)), Evas_Preload_Pthread_Worker);
220 EINA_INLIST_GET(work)),
221 Evas_Preload_Pthread_Worker);
222 LKU(_mutex); 216 LKU(_mutex);
223 if (work->func_cancel) work->func_cancel(work->data); 217 if (work->func_cancel) work->func_cancel(work->data);
224 free(work); 218 free(work);