Image_Entry *ie;
};
-static LK(engine_lock) = EINA_LOCK_INITIALIZER;
-static LK(wakeup) = EINA_LOCK_INITIALIZER;
+static LK(engine_lock);
+static LK(wakeup);
+static int _evas_cache_mutex_init = 0;
static pthread_cond_t cond_wakeup = PTHREAD_COND_INITIALIZER;
{
Evas_Cache_Image *cache;
+ if (_evas_cache_mutex_init++ == 0)
+ {
+ LKI(engine_lock);
+ LKI(wakeup);
+ }
+
cache = calloc(1, sizeof(Evas_Cache_Image));
if (!cache) return NULL;
cache->func = *cb;
LKL(cache->lock);
#endif
cache->references--;
- if (cache->references > 0)
+ if (cache->references != 0)
{
#ifdef EVAS_FRAME_QUEUING
LKU(cache->lock);
#endif
return;
}
+#ifdef EVAS_FRAME_QUEUING
+ /* Release and destroy lock early ! */
+ LKU(cache->lock);
+ LKD(cache->lock);
+#endif
+
#ifdef BUILD_ASYNC_PRELOAD
EINA_LIST_FREE(cache->preload, im)
{
#endif
eina_hash_free(cache->activ);
eina_hash_free(cache->inactiv);
-#ifdef EVAS_FRAME_QUEUING
- LKU(cache->lock);
- LKD(cache->lock);
-#endif
free(cache);
+
+ if (--_evas_cache_mutex_init == 0)
+ {
+ LKD(engine_lock);
+ LKD(wakeup);
+ }
}
EAPI Image_Entry *
static int _threads_count = 0;
static Evas_Preload_Pthread_Worker *_workers = NULL;
-static LK(_mutex) = EINA_LOCK_INITIALIZER;
+static LK(_mutex);
static void
_evas_preload_thread_end(void *data)
Evas_Preload_Pthread_Data *p = NULL;
if (pthread_join(pth->thread, (void **)&p) != 0) free(p);
+
+ eina_threads_shutdown();
}
static void
else
work->func_end(work->data);
- eina_threads_shutdown();
free(work);
}
{
Evas_Preload_Pthread_Data *pth = data;
Evas_Preload_Pthread_Worker *work;
-
+
eina_sched_prio_drop();
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
{
_threads_max = eina_cpu_count();
if (_threads_max < 1) _threads_max = 1;
+
+ LKI(_mutex);
}
void
free(work);
}
LKU(_mutex);
+
+ LKD(_mutex);
#endif
}