forked from enlightenment/efl
evas/cache - formatting
This commit is contained in:
parent
53fa4cd2d8
commit
0920a8e182
|
@ -56,7 +56,7 @@ _evas_preload_thread_done(void *target EINA_UNUSED, Evas_Callback_Type type EINA
|
||||||
Evas_Preload_Pthread_Worker *work = event_info;
|
Evas_Preload_Pthread_Worker *work = event_info;
|
||||||
if (work->cancel)
|
if (work->cancel)
|
||||||
{
|
{
|
||||||
if (work->func_cancel) work->func_cancel(work->data);
|
if (work->func_cancel) work->func_cancel(work->data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
work->func_end(work->data);
|
work->func_end(work->data);
|
||||||
|
@ -73,28 +73,26 @@ _evas_preload_thread_worker(void *data, Eina_Thread thread EINA_UNUSED)
|
||||||
on_error:
|
on_error:
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
LKL(_mutex);
|
LKL(_mutex);
|
||||||
if (!_workers)
|
if (!_workers)
|
||||||
{
|
{
|
||||||
LKU(_mutex);
|
LKU(_mutex);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
work = _workers;
|
work = _workers;
|
||||||
_workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers),
|
_workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers), EINA_INLIST_GET(_workers)), Evas_Preload_Pthread_Worker);
|
||||||
EINA_INLIST_GET(_workers)),
|
LKU(_mutex);
|
||||||
Evas_Preload_Pthread_Worker);
|
|
||||||
LKU(_mutex);
|
|
||||||
|
|
||||||
if (work->func_heavy) work->func_heavy(work->data);
|
if (work->func_heavy) work->func_heavy(work->data);
|
||||||
evas_async_events_put(pth, 0, work, _evas_preload_thread_done);
|
evas_async_events_put(pth, 0, work, _evas_preload_thread_done);
|
||||||
}
|
}
|
||||||
|
|
||||||
LKL(_mutex);
|
LKL(_mutex);
|
||||||
if (_workers)
|
if (_workers)
|
||||||
{
|
{
|
||||||
LKU(_mutex);
|
LKU(_mutex);
|
||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
_threads_count--;
|
_threads_count--;
|
||||||
LKU(_mutex);
|
LKU(_mutex);
|
||||||
|
@ -134,11 +132,9 @@ _evas_preload_thread_shutdown(void)
|
||||||
while (_workers)
|
while (_workers)
|
||||||
{
|
{
|
||||||
work = _workers;
|
work = _workers;
|
||||||
_workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers),
|
_workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers), EINA_INLIST_GET(_workers)), Evas_Preload_Pthread_Worker);
|
||||||
EINA_INLIST_GET(_workers)),
|
|
||||||
Evas_Preload_Pthread_Worker);
|
|
||||||
if (work->func_cancel) work->func_cancel(work->data);
|
if (work->func_cancel) work->func_cancel(work->data);
|
||||||
free(work);
|
free(work);
|
||||||
}
|
}
|
||||||
LKU(_mutex);
|
LKU(_mutex);
|
||||||
|
|
||||||
|
@ -147,9 +143,9 @@ _evas_preload_thread_shutdown(void)
|
||||||
|
|
||||||
Evas_Preload_Pthread *
|
Evas_Preload_Pthread *
|
||||||
evas_preload_thread_run(void (*func_heavy) (void *data),
|
evas_preload_thread_run(void (*func_heavy) (void *data),
|
||||||
void (*func_end) (void *data),
|
void (*func_end) (void *data),
|
||||||
void (*func_cancel) (void *data),
|
void (*func_cancel) (void *data),
|
||||||
const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
Evas_Preload_Pthread_Worker *work;
|
Evas_Preload_Pthread_Worker *work;
|
||||||
Evas_Preload_Pthread_Data *pth;
|
Evas_Preload_Pthread_Data *pth;
|
||||||
|
@ -157,8 +153,8 @@ evas_preload_thread_run(void (*func_heavy) (void *data),
|
||||||
work = malloc(sizeof(Evas_Preload_Pthread_Worker));
|
work = malloc(sizeof(Evas_Preload_Pthread_Worker));
|
||||||
if (!work)
|
if (!work)
|
||||||
{
|
{
|
||||||
func_cancel((void *)data);
|
func_cancel((void *)data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
work->func_heavy = func_heavy;
|
work->func_heavy = func_heavy;
|
||||||
|
@ -171,8 +167,8 @@ evas_preload_thread_run(void (*func_heavy) (void *data),
|
||||||
_workers = (Evas_Preload_Pthread_Worker *)eina_inlist_append(EINA_INLIST_GET(_workers), EINA_INLIST_GET(work));
|
_workers = (Evas_Preload_Pthread_Worker *)eina_inlist_append(EINA_INLIST_GET(_workers), EINA_INLIST_GET(work));
|
||||||
if (_threads_count == _threads_max)
|
if (_threads_count == _threads_max)
|
||||||
{
|
{
|
||||||
LKU(_mutex);
|
LKU(_mutex);
|
||||||
return (Evas_Preload_Pthread *)work;
|
return (Evas_Preload_Pthread *)work;
|
||||||
}
|
}
|
||||||
LKU(_mutex);
|
LKU(_mutex);
|
||||||
|
|
||||||
|
@ -184,21 +180,21 @@ evas_preload_thread_run(void (*func_heavy) (void *data),
|
||||||
|
|
||||||
if (eina_thread_create(&pth->thread, EINA_THREAD_BACKGROUND, -1, _evas_preload_thread_worker, pth))
|
if (eina_thread_create(&pth->thread, EINA_THREAD_BACKGROUND, -1, _evas_preload_thread_worker, pth))
|
||||||
{
|
{
|
||||||
LKL(_mutex);
|
LKL(_mutex);
|
||||||
_threads_count++;
|
_threads_count++;
|
||||||
LKU(_mutex);
|
LKU(_mutex);
|
||||||
return (Evas_Preload_Pthread*)work;
|
return (Evas_Preload_Pthread*)work;
|
||||||
}
|
}
|
||||||
|
|
||||||
eina_threads_shutdown();
|
eina_threads_shutdown();
|
||||||
|
|
||||||
on_error:
|
on_error:
|
||||||
LKL(_mutex);
|
LKL(_mutex);
|
||||||
if (_threads_count == 0)
|
if (_threads_count == 0)
|
||||||
{
|
{
|
||||||
LKU(_mutex);
|
LKU(_mutex);
|
||||||
if (work->func_cancel) work->func_cancel(work->data);
|
if (work->func_cancel) work->func_cancel(work->data);
|
||||||
free(work);
|
free(work);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
LKU(_mutex);
|
LKU(_mutex);
|
||||||
|
@ -216,9 +212,7 @@ evas_preload_thread_cancel(Evas_Preload_Pthread *thread)
|
||||||
{
|
{
|
||||||
if (work == (Evas_Preload_Pthread_Worker *)thread)
|
if (work == (Evas_Preload_Pthread_Worker *)thread)
|
||||||
{
|
{
|
||||||
_workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers),
|
_workers = EINA_INLIST_CONTAINER_GET(eina_inlist_remove(EINA_INLIST_GET(_workers), EINA_INLIST_GET(work)), Evas_Preload_Pthread_Worker);
|
||||||
EINA_INLIST_GET(work)),
|
|
||||||
Evas_Preload_Pthread_Worker);
|
|
||||||
LKU(_mutex);
|
LKU(_mutex);
|
||||||
if (work->func_cancel) work->func_cancel(work->data);
|
if (work->func_cancel) work->func_cancel(work->data);
|
||||||
free(work);
|
free(work);
|
||||||
|
|
Loading…
Reference in New Issue