void *data;
} item_free;
} cb;
+ LK(lock);
Eina_Bool sorted : 1;
Eina_Bool fetch_thread : 1;
Eina_Bool multi_load : 1;
}
else
{
+ LKL(st->lock);
+ st->live = EINA_FALSE;
Eina_List *l;
Eina_List *l_next;
Eina_List *header_list;
elm_genlist_clear(st->genlist);
st->genlist = NULL;
}
+ LKD(st->lock);
}
free(st);
}
{
Elm_Store *st = calloc(1, size);
if (!st) return NULL;
+ LKI(st->lock);
eina_magic_string_set(ELM_STORE_MAGIC, "Elm_Store");
eina_magic_string_set(ELM_STORE_FILESYSTEM_MAGIC, "Elm_Store_Filesystem");
{
if(header_list)
{
- if ((in_index + (signed)eina_list_count(header_list)) > index)
+ if ((in_index + eina_list_count(header_list)) > index)
{
sti = eina_list_nth(header_list, index - in_index);
- LKL(sti->lock);
- if (st->cb.fetch.func)
+ if(sti)
{
- if (st->fetch_thread)
+ if (st->cb.fetch.func)
{
- if (!sti->fetch_th)
+ LKL(sti->lock);
+ if (st->fetch_thread)
+ {
+ if (!sti->fetch_th)
+ {
+ LKU(sti->lock);
+ sti->fetch_th = ecore_thread_run(_store_fetch_do,
+ _store_fetch_end,
+ _store_fetch_cancel,
+ sti);
+ LKL(sti->lock);
+ }
+ }
+ else
{
LKU(sti->lock);
- sti->fetch_th = ecore_thread_run(_store_fetch_do,
- _store_fetch_end,
- _store_fetch_cancel,
- sti);
+ st->cb.fetch.func(st->cb.fetch.data, sti, sti->item_info);
LKL(sti->lock);
+ sti->fetched = EINA_TRUE;
}
}
- else
- {
- LKU(sti->lock);
- st->cb.fetch.func(st->cb.fetch.data, sti, sti->item_info);
- LKL(sti->lock);
- sti->fetched = EINA_TRUE;
- }
+ LKU(sti->lock);
+ return sti;
+ }
+ else
+ {
+ return NULL;
}
- LKU(sti->lock);
- return sti;
}
else
{
if ((in_index + (signed)eina_list_count(header_list)) > index)
{
sti = eina_list_nth(header_list, index - in_index);
- LKL(sti->lock);
- if (st->cb.unfetch.func)
+ if(sti)
{
- if (sti->fetch_th)
+ if (st->cb.unfetch.func)
{
+ LKL(sti->lock);
+
+ if (sti->fetch_th)
+ {
+ LKU(sti->lock);
+ ecore_thread_cancel(sti->fetch_th);
+ sti->fetch_th = NULL;
+ LKL(sti->lock);
+ }
LKU(sti->lock);
- ecore_thread_cancel(sti->fetch_th);
- sti->fetch_th = NULL;
+ st->cb.unfetch.func(st->cb.unfetch.data, sti, sti->item_info);
LKL(sti->lock);
+ sti->fetched = EINA_FALSE;
}
LKU(sti->lock);
- st->cb.unfetch.func(st->cb.unfetch.data, sti, sti->item_info);
- LKL(sti->lock);
- sti->fetched = EINA_FALSE;
+ return sti;
+ }
+ else
+ {
+ return NULL;
}
- LKU(sti->lock);
- return sti;
}
else
{
sti = calloc(1, sizeof(Elm_Store_Item));
if (!sti) return NULL;
- if (st->fetch_thread)
- {
- LKI(sti->lock);
- }
+
+ LKI(sti->lock);
EINA_MAGIC_SET(sti, ELM_STORE_ITEM_MAGIC);
sti->store = st;
if (st->live)
{
+ LKL(st->lock);
if (sti->item_info->item_type == ELM_GENLIST_ITEM_GROUP)
{
_group_item_append(sti, itc);
{
_normal_item_append(sti, itc);
}
+ LKU(st->lock);
return sti;
}
else