work = eina_list_data_get(_workers);
_workers = eina_list_remove_list(_workers, _workers);
-
LKU(_mutex);
-
+
if (work->func_heavy) work->func_heavy(work->data);
evas_async_events_put(pth, 0, work, _evas_preload_thread_done);
}
goto on_error;
}
_threads_count--;
-
LKU(_mutex);
// dummy worker to wake things up
work->cancel = EINA_FALSE;
evas_async_events_put(pth, 0, work, _evas_preload_thread_done);
-
return pth;
}
#endif
_evas_preload_thread_init(void)
{
_threads_max = eina_cpu_count();
- if (_threads_max <= 0) _threads_max = 1;
+ if (_threads_max < 1) _threads_max = 1;
}
void
/* Force processing of async events. */
evas_async_events_process();
-
LKL(_mutex);
-
EINA_LIST_FREE(_workers, work)
{
if (work->func_cancel) work->func_cancel(work->data);
free(work);
}
-
LKU(_mutex);
#endif
}
LKL(_mutex);
_workers = eina_list_append(_workers, work);
-
if (_threads_count == _threads_max)
{
pthread_mutex_unlock(&_mutex);
return (Evas_Preload_Pthread *)work;
}
-
LKU(_mutex);
/* One more thread could be created. */
}
on_error:
+ LKL(_mutex);
if (_threads_count == 0)
{
+ LKU(_mutex);
if (work->func_cancel) work->func_cancel(work->data);
free(work);
}
+ LKU(_mutex);
return NULL;
#else
/*
*/
func_heavy((void *)data);
func_end((void *)data);
- return EINA_TRUE;
+ return (void *)1;
#endif
}
Evas_Preload_Pthread_Worker *work;
Eina_List *l;
+ if (!thread) return EINA_TRUE;
LKL(_mutex);
EINA_LIST_FOREACH(_workers, l, work)
{