Elementary: Use eina_lock in elm_store
authorkakaroto <kakaroto@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 5 Nov 2011 17:49:11 +0000 (17:49 +0000)
committerMike McCormack <mj.mccormack@samsung.com>
Fri, 18 Nov 2011 03:00:09 +0000 (12:00 +0900)
git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@64775 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
m4/efl_threads.m4 [deleted file]
src/lib/Makefile.am
src/lib/elm_store.c

index 149a499..9ecb665 100755 (executable)
@@ -617,15 +617,6 @@ ELM_LIBINTL_H_DEF="#undef"
 AC_CHECK_HEADER(libintl.h, [ELM_LIBINTL_H_DEF="#define"])
 AC_SUBST(ELM_LIBINTL_H_DEF)
 
-EFL_CHECK_THREADS([
-  TH=1
-] , [
-  AC_MSG_ERROR(no thread support found. required.)
-  exit 1
-])
-AC_SUBST(EFL_PTHREAD_CFLAGS)
-AC_SUBST(EFL_PTHREAD_LIBS)
-
 my_libs="-lm"
 AC_SUBST(my_libs)
 AC_SUBST(requirement_elm)
diff --git a/m4/efl_threads.m4 b/m4/efl_threads.m4
deleted file mode 100644 (file)
index 33d15a3..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
-dnl rwlock code added by Mike Blumenkrantz <mike at zentific dot com>
-dnl This code is public domain and can be freely used or copied.
-
-dnl Macro that check if POSIX or Win32 threads library is available or not.
-
-dnl Usage: EFL_CHECK_THREADS(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
-dnl Call AC_SUBST(EFL_PTHREAD_CFLAGS)
-dnl Call AC_SUBST(EFL_PTHREAD_LIBS)
-dnl Defines EFL_HAVE_POSIX_THREADS or EFL_HAVE_WIN32_THREADS, and EFL_HAVE_THREADS
-
-AC_DEFUN([EFL_CHECK_THREADS],
-[
-
-dnl configure option
-
-AC_ARG_ENABLE([posix-threads],
-   [AC_HELP_STRING([--disable-posix-threads], [enable POSIX threads code @<:@default=auto@:>@])],
-   [
-    if test "x${enableval}" = "xyes" ; then
-       _efl_enable_posix_threads="yes"
-    else
-       _efl_enable_posix_threads="no"
-    fi
-   ],
-   [_efl_enable_posix_threads="auto"])
-
-AC_MSG_CHECKING([whether to build POSIX threads code])
-AC_MSG_RESULT([${_efl_enable_posix_threads}])
-
-AC_ARG_ENABLE([win32-threads],
-   [AC_HELP_STRING([--disable-win32-threads], [enable Win32 threads code @<:@default=no@:>@])],
-   [
-    if test "x${enableval}" = "xyes" ; then
-       _efl_enable_win32_threads="yes"
-    else
-       _efl_enable_win32_threads="no"
-    fi
-   ],
-   [_efl_enable_win32_threads="no"])
-
-AC_MSG_CHECKING([whether to build Windows threads code])
-AC_MSG_RESULT([${_efl_enable_win32_threads}])
-
-dnl
-dnl * no  + no
-dnl * yes + no  : win32: error,    other : pthread
-dnl * yes + yes : win32 : wthread, other : pthread
-dnl * no  + yes : win32 : wthread, other : error
-
-if  test "x${_efl_enable_posix_threads}" = "xyes" && test "x${_efl_enable_win32_threads}" = "xyes" ; then
-   case "$host_os" in
-      mingw*)
-         _efl_enable_posix_threads=no
-         ;;
-      *)
-         _efl_enable_win32_threads=no
-         ;;
-   esac
-fi
-
-if  test "x${_efl_enable_win32_threads}" = "xyes" ; then
-   case "$host_os" in
-      mingw*)
-         ;;
-      *)
-         AC_MSG_ERROR([Win32 threads support requested but non Windows system found.])
-         ;;
-   esac
-fi
-
-if  test "x${_efl_enable_posix_threads}" = "xyes" ; then
-   case "$host_os" in
-      mingw*)
-         AC_MSG_ERROR([POSIX threads support requested but Windows system found.])
-         ;;
-      *)
-         ;;
-   esac
-fi
-
-dnl check if the compiler supports POSIX threads
-
-case "$host_os" in
-   mingw*)
-      ;;
-   solaris*)
-      _efl_threads_cflags="-mt"
-      _efl_threads_libs="-mt"
-      ;;
-   *)
-      _efl_threads_cflags="-pthread"
-      _efl_threads_libs="-pthread"
-      ;;
-esac
-
-_efl_have_posix_threads="no"
-_efl_have_win32_threads="no"
-
-if test "x${_efl_enable_posix_threads}" = "xyes" || test "x${_efl_enable_posix_threads}" = "xauto" ; then
-
-   SAVE_CFLAGS=${CFLAGS}
-   CFLAGS="${CFLAGS} ${_efl_threads_cflags}"
-   SAVE_LIBS=${LIBS}
-   LIBS="${LIBS} ${_efl_threads_libs}"
-   AC_LINK_IFELSE(
-      [AC_LANG_PROGRAM([[
-#include <pthread.h>
-                       ]],
-                       [[
-pthread_t id;
-id = pthread_self();
-                       ]])],
-      [_efl_have_posix_threads="yes"],
-      [_efl_have_posix_threads="no"])
-   CFLAGS=${SAVE_CFLAGS}
-   LIBS=${SAVE_LIBS}
-
-fi
-
-AC_MSG_CHECKING([whether system support POSIX threads])
-AC_MSG_RESULT([${_efl_have_posix_threads}])
-if test "$x{_efl_enable_posix_threads}" = "xyes" && test "x${_efl_have_posix_threads}" = "xno"; then
-   AC_MSG_ERROR([POSIX threads support requested but not found.])
-fi
-
-EFL_PTHREAD_CFLAGS=""
-EFL_PTHREAD_LIBS=""
-if test "x${_efl_have_posix_threads}" = "xyes" ; then
-   EFL_PTHREAD_CFLAGS=${_efl_threads_cflags}
-   EFL_PTHREAD_LIBS=${_efl_threads_libs}
-fi
-
-AC_SUBST(EFL_PTHREAD_CFLAGS)
-AC_SUBST(EFL_PTHREAD_LIBS)
-
-_efl_enable_debug_threads="no"
-AC_ARG_ENABLE([debug-threads],
-   [AC_HELP_STRING([--enable-debug-threads], [disable assert when you forgot to call eina_threads_init])],
-   [_efl_enable_debug_threads="${enableval}"])
-
-have_debug_threads="no"
-if test "x${_efl_have_posix_threads}" = "xyes" -a "x${_efl_enable_debug_threads}" = "xyes"; then
-   have_debug_threads="yes"
-   AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call eina_threads_init])
-fi
-
-if test "x${_efl_have_posix_threads}" = "xyes" ; then
-   AC_DEFINE([EFL_HAVE_POSIX_THREADS], [1], [Define to mention that POSIX threads are supported])
-fi
-
-if test "x${_efl_enable_win32_threads}" = "xyes" ; then
-   _efl_have_win32_threads="yes"
-   AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32 threads are supported])
-fi
-
-if test "x${_efl_have_posix_threads}" = "xyes" || test "x${_efl_have_win32_threads}" = "xyes" ; then
-   AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
-fi
-
-AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"], [$1], [$2])
-])
-
-dnl Usage: EFL_CHECK_SPINLOCK(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
-dnl Defines EFL_HAVE_POSIX_THREADS_SPINLOCK
-AC_DEFUN([EFL_CHECK_SPINLOCK],
-[
-
-dnl check if the compiler supports pthreads spinlock
-
-_efl_have_posix_threads_spinlock="no"
-
-if test "x${_efl_have_posix_threads}" = "xyes" ; then
-
-   SAVE_CFLAGS=${CFLAGS}
-   CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
-   SAVE_LIBS=${LIBS}
-   LIBS="${LIBS} ${EFL_PTHREAD_LIBS}"
-   AC_LINK_IFELSE(
-      [AC_LANG_PROGRAM([[
-#include <pthread.h>
-                       ]],
-                       [[
-pthread_spinlock_t lock;
-int res;
-res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE);
-                       ]])],
-      [_efl_have_posix_threads_spinlock="yes"],
-      [_efl_have_posix_threads_spinlock="no"])
-   CFLAGS=${SAVE_CFLAGS}
-   LIBS=${SAVE_LIBS}
-
-fi
-
-AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
-AC_MSG_RESULT([${_efl_have_posix_threads_spinlock}])
-if test "x${_efl_enable_posix_threads}" = "xyes" && test "x${_efl_have_posix_threads_spinlock}" = "xno" ; then
-   AC_MSG_WARN([POSIX threads support requested but spinlocks are not supported])
-fi
-
-if test "x${_efl_have_posix_threads_spinlock}" = "xyes" ; then
-   AC_DEFINE([EFL_HAVE_POSIX_THREADS_SPINLOCK], [1], [Define to mention that POSIX threads spinlocks are supported])
-fi
-AS_IF([test "x$_efl_have_posix_threads_spinlock" = "xyes"], [$1], [$2])
-])
-
index d4499ef..378ce41 100644 (file)
@@ -25,8 +25,7 @@ AM_CPPFLAGS = \
 @ELEMENTARY_EMAP_CFLAGS@ \
 @EVIL_CFLAGS@ \
 @EIO_CFLAGS@ \
-@EMOTION_CFLAGS@ \
-@EFL_PTHREAD_CFLAGS@
+@EMOTION_CFLAGS@
 
 if ELEMENTARY_WINDOWS_BUILD
 AM_CPPFLAGS += -DELEMENTARY_BUILD
@@ -162,8 +161,8 @@ libelementary_la_LIBADD = \
 @ELEMENTARY_EMAP_LIBS@ \
 @EVIL_LIBS@ \
 @EIO_LIBS@ \
-@EMOTION_LIBS@ \
-@EFL_PTHREAD_LIBS@
+@EMOTION_LIBS@
+
 libelementary_la_LDFLAGS = \
 -no-undefined @lt_enable_auto_import@ \
 -version-info @version_info@ @release_info@
index 74ae0ff..46915e0 100644 (file)
@@ -2,28 +2,6 @@
 #include <Elementary_Cursor.h>
 #include "elm_priv.h"
 
-#ifndef EFL_HAVE_THREADS
-# error "No thread support. Required."
-#endif
-
-#ifdef EFL_HAVE_POSIX_THREADS
-# include <pthread.h>
-# define LK(x)  pthread_mutex_t x
-# define LKI(x) pthread_mutex_init(&(x), NULL);
-# define LKD(x) pthread_mutex_destroy(&(x));
-# define LKL(x) pthread_mutex_lock(&(x));
-# define LKU(x) pthread_mutex_unlock(&(x));
-#else /* EFL_HAVE_WIN32_THREADS */
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-# define LK(x)  HANDLE x
-# define LKI(x) x = CreateMutex(NULL, FALSE, NULL)
-# define LKD(x) CloseHandle(x)
-# define LKL(x) WaitForSingleObject(x, INFINITE)
-# define LKU(x) ReleaseMutex(x)
-#endif
-
 #define ELM_STORE_MAGIC            0x3f89ea56
 #define ELM_STORE_FILESYSTEM_MAGIC 0x3f89ea57
 #define ELM_STORE_DBSYSTEM_MAGIC   0x3f89ea58
@@ -90,7 +68,7 @@ struct _Elm_Store_Item
    Elm_Store_Item_Info          *item_info;
    Elm_Genlist_Item             *first_item;
    Elm_Genlist_Item             *last_item;
-   LK(lock);
+   Eina_Lock                    *lock;
    Eina_Bool                     live : 1;
    Eina_Bool                     was_live : 1;
    Eina_Bool                     realized : 1;
@@ -146,24 +124,24 @@ _store_cache_trim(Elm_Store *st)
              st->realized = eina_list_remove_list(st->realized, st->realized);
              sti->realized = EINA_FALSE;
           }
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         if (!sti->fetched)
           {
-             LKU(sti->lock);
+             eina_lock_release(sti->lock);
              if (sti->fetch_th)
                {
                   ecore_thread_cancel(sti->fetch_th);
                   sti->fetch_th = NULL;
                }
-             LKL(sti->lock);
+             eina_lock_take(sti->lock);
           }
         sti->fetched = EINA_FALSE;
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
         if (st->cb.unfetch.func)
           st->cb.unfetch.func(st->cb.unfetch.data, sti, NULL);
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         sti->data = NULL;
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
      }
 }
 
@@ -194,7 +172,7 @@ _store_genlist_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
                st->cb.unfetch.func(st->cb.unfetch.data, sti, NULL);
              sti->data = NULL;
           }
-        LKD(sti->lock);
+        eina_lock_free(sti->lock);
         free(sti);
      }
    // FIXME: kill threads and more
@@ -208,21 +186,21 @@ static void
 _store_filesystem_fetch_do(void *data, Ecore_Thread *th __UNUSED__)
 {
    Elm_Store_Item *sti = data;
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    if (sti->data)
      {
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
         return;
      }
    if (!sti->fetched)
      {
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
         if (sti->store->cb.fetch.func)
           sti->store->cb.fetch.func(sti->store->cb.fetch.data, sti, NULL);
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         sti->fetched = EINA_TRUE;
      }
-   LKU(sti->lock);
+   eina_lock_release(sti->lock);
 }
 //     ************************************************************************
 ////   * End of separate thread function.                                     *
@@ -232,9 +210,9 @@ static void
 _store_filesystem_fetch_end(void *data, Ecore_Thread *th)
 {
    Elm_Store_Item *sti = data;
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    if (sti->data) elm_genlist_item_update(sti->item);
-   LKU(sti->lock);
+   eina_lock_release(sti->lock);
    if (th == sti->fetch_th) sti->fetch_th = NULL;
 }
 
@@ -243,10 +221,10 @@ static void
 _store_filesystem_fetch_cancel(void *data, Ecore_Thread *th)
 {
    Elm_Store_Item *sti = data;
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    if (th == sti->fetch_th) sti->fetch_th = NULL;
    if (sti->data) elm_genlist_item_update(sti->item);
-   LKU(sti->lock);
+   eina_lock_release(sti->lock);
 }
 
 static void
@@ -329,7 +307,7 @@ _store_item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
 {
    Elm_Store_Item *sti = data;
    const char *s = "";
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    if (sti->data)
      {
         const Elm_Store_Item_Mapping *m = _store_item_mapping_find(sti, part);
@@ -349,15 +327,15 @@ _store_item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
                }
           }
      }
-   LKU(sti->lock);
-   return strdup(s);
+   eina_lock_release(sti->lock);
+   return s ? strdup(s) : NULL;
 }
 
 static Evas_Object *
 _store_item_icon_get(void *data, Evas_Object *obj, const char *part)
 {
    Elm_Store_Item *sti = data;
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    if (sti->data)
      {
         const Elm_Store_Item_Mapping *m = _store_item_mapping_find(sti, part);
@@ -403,11 +381,11 @@ _store_item_icon_get(void *data, Evas_Object *obj, const char *part)
                 default:
                    break;
                }
-             LKU(sti->lock);
+             eina_lock_release(sti->lock);
              return ic;
           }
      }
-   LKU(sti->lock);
+   eina_lock_release(sti->lock);
    return NULL;
 }
 
@@ -503,7 +481,7 @@ _store_filesystem_list_update(void *data, Ecore_Thread *th __UNUSED__, void *msg
 
    sti = calloc(1, sizeof(Elm_Store_Item_Filesystem));
    if (!sti) goto done;
-   LKI(sti->base.lock);
+   eina_lock_new(sti->base.lock);
    EINA_MAGIC_SET(&(sti->base), ELM_STORE_ITEM_MAGIC);
    sti->base.store = st;
    sti->base.data = info->base.data;
@@ -618,7 +596,7 @@ elm_store_free(Elm_Store *st)
                     st->cb.unfetch.func(st->cb.unfetch.data, sti, NULL);
                   sti->data = NULL;
                }
-             LKD(sti->lock);
+             eina_lock_take(sti->lock);
              free(sti);
           }
         if (st->genlist)
@@ -798,9 +776,9 @@ EAPI void
 elm_store_item_data_set(Elm_Store_Item *sti, void *data)
 {
    if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return;
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    sti->data = data;
-   LKU(sti->lock);
+   eina_lock_release(sti->lock);
 }
 
 EAPI void *
@@ -808,9 +786,9 @@ elm_store_item_data_get(Elm_Store_Item *sti)
 {
    if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return NULL;
    void *d;
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    d = sti->data;
-   LKU(sti->lock);
+   eina_lock_release(sti->lock);
    return d;
 }
 
@@ -869,7 +847,7 @@ _item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
    Elm_Store *st = sti->store;
    if (st->live)
      {
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         if (sti->data)
           {
              const char *s = "";
@@ -879,17 +857,17 @@ _item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
                   switch (m->type)
                     {
                      case ELM_STORE_ITEM_MAPPING_LABEL:
-                        LKU(sti->lock);
+                        eina_lock_release(sti->lock);
                         s = *(char **)(((unsigned char *)sti->data) + m->offset);
-                        LKL(sti->lock);
+                        eina_lock_take(sti->lock);
                         break;
 
                      case ELM_STORE_ITEM_MAPPING_CUSTOM:
                         if (m->details.custom.func)
                           {
-                             LKU(sti->lock);
+                             eina_lock_release(sti->lock);
                              s = m->details.custom.func(sti->data, sti, part);
-                             LKL(sti->lock);
+                             eina_lock_take(sti->lock);
                           }
                         break;
 
@@ -898,12 +876,12 @@ _item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
                     }
                   if (s)
                     {
-                       LKU(sti->lock);
+                       eina_lock_release(sti->lock);
                        return strdup(s);
                     }
                   else
                     {
-                       LKU(sti->lock);
+                       eina_lock_release(sti->lock);
                        return NULL;
                     }
                }
@@ -916,34 +894,34 @@ _item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
                {
                   if (m->details.custom.func)
                     {
-                       LKU(sti->lock);
+                       eina_lock_release(sti->lock);
                        s = m->details.custom.func(sti->item_info, sti, part);
-                       LKL(sti->lock);
+                       eina_lock_take(sti->lock);
                     }
 
                   if (s)
                     {
-                       LKU(sti->lock);
+                       eina_lock_release(sti->lock);
                        return strdup(s);
                     }
                   else
                     {
-                       LKU(sti->lock);
+                       eina_lock_release(sti->lock);
                        return NULL;
                     }
                }
-             LKU(sti->lock);
+             eina_lock_release(sti->lock);
              return NULL;
              /*
                 if (!strcmp(part, "elm.text.1"))
                 {
-                LKU(sti->lock);
+                eina_lock_release(sti->lock);
              //                           elm_genlist_item_display_only_set(sti->item, EINA_TRUE);
              return strdup("Loading..");
              }
               */
           }
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
      }
    return NULL;
 }
@@ -956,7 +934,7 @@ _item_icon_get(void *data, Evas_Object *obj, const char *part)
 
    if (st->live && sti->item)
      {
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         if (sti->data)
           {
              const Elm_Store_Item_Mapping *m = _item_mapping_find(sti, part);
@@ -1006,11 +984,11 @@ _item_icon_get(void *data, Evas_Object *obj, const char *part)
                      default:
                         break;
                     }
-                  LKU(sti->lock);
+                  eina_lock_release(sti->lock);
                   return ic;
                }
           }
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
      }
    return NULL;
 }
@@ -1061,33 +1039,33 @@ _store_fetch_do(void *data, Ecore_Thread *th __UNUSED__)
 {
    Elm_Store_Item *sti = data;
 
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    if (sti->data)
      {
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
         return;
      }
    if (!sti->fetched)
      {
         if (sti->item_info != NULL)
           {
-             LKU(sti->lock);
+             eina_lock_release(sti->lock);
              if (sti->store->cb.fetch.func)
                sti->store->cb.fetch.func(sti->store->cb.fetch.data, sti, sti->item_info);
-             LKL(sti->lock);
+             eina_lock_take(sti->lock);
              sti->fetched = EINA_TRUE;
           }
      }
-   LKU(sti->lock);
+   eina_lock_release(sti->lock);
 }
 
 static void
 _store_fetch_end(void *data, Ecore_Thread *th)
 {
    Elm_Store_Item *sti = data;
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    if (sti->data) elm_genlist_item_update(sti->item);
-   LKU(sti->lock);
+   eina_lock_release(sti->lock);
    if (th == sti->fetch_th) sti->fetch_th = NULL;
 }
 
@@ -1095,10 +1073,10 @@ static void
 _store_fetch_cancel(void *data, Ecore_Thread *th)
 {
    Elm_Store_Item *sti = data;
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    if (th == sti->fetch_th) sti->fetch_th = NULL;
    //   if(sti->data) elm_genlist_item_update(sti->item);
-   LKU(sti->lock);
+   eina_lock_release(sti->lock);
 }
 
 static void
@@ -1122,24 +1100,24 @@ _item_eval(void *data)
      }
    else
      {
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         if (!sti->fetched)
           {
-             LKU(sti->lock);
+             eina_lock_release(sti->lock);
              if (sti->fetch_th)
                {
                   ecore_thread_cancel(sti->fetch_th);
                   sti->fetch_th = NULL;
                }
-             LKL(sti->lock);
+             eina_lock_take(sti->lock);
           }
         sti->fetched = EINA_FALSE;
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
         if (st->cb.unfetch.func)
           st->cb.unfetch.func(st->cb.unfetch.data, sti, sti->item_info);
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         sti->data = NULL;
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
      }
 }
 
@@ -1193,26 +1171,26 @@ _item_fetch(Elm_Store_Item *sti)
 
    if (st->live)
      {
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         if (!sti->fetched)
           {
-             LKU(sti->lock);
+             eina_lock_release(sti->lock);
              if (sti->fetch_th)
                {
                   ecore_thread_cancel(sti->fetch_th);
                   sti->fetch_th = NULL;
                }
-             LKL(sti->lock);
+             eina_lock_take(sti->lock);
           }
         if (sti->item_info != NULL)
           {
-             LKU(sti->lock);
+             eina_lock_release(sti->lock);
              if (sti->store->cb.fetch.func)
                sti->store->cb.fetch.func(sti->store->cb.fetch.data, sti, sti->item_info);
-             LKL(sti->lock);
+             eina_lock_take(sti->lock);
              sti->fetched = EINA_TRUE;
           }
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
      }
 }
 
@@ -1224,24 +1202,24 @@ _item_unfetch(Elm_Store_Item *sti)
 
    if (st->live)
      {
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         if (!sti->fetched)
           {
-             LKU(sti->lock);
+             eina_lock_release(sti->lock);
              if (sti->fetch_th)
                {
                   ecore_thread_cancel(sti->fetch_th);
                   sti->fetch_th = NULL;
                }
-             LKL(sti->lock);
+             eina_lock_take(sti->lock);
           }
         sti->fetched = EINA_FALSE;
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
         if (st->cb.unfetch.func)
           st->cb.unfetch.func(st->cb.unfetch.data, sti, sti->item_info);
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         sti->data = NULL;
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
      }
 }
 
@@ -1285,16 +1263,16 @@ _item_free(Elm_Store_Item *sti)
 {
    if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return;
    Elm_Store *st = sti->store;
-   LKL(sti->lock);
+   eina_lock_take(sti->lock);
    if (st->live && st->cb.item_free.func && sti->item_info)
      {
-        LKU(sti->lock);
+        eina_lock_release(sti->lock);
         st->cb.item_free.func(st->cb.item_free.data, sti->item_info);
-        LKL(sti->lock);
+        eina_lock_take(sti->lock);
         sti->item_info = NULL;
      }
-   LKU(sti->lock);
-   LKD(sti->lock);
+   eina_lock_release(sti->lock);
+   eina_lock_take(sti->lock);
    free(sti);
 }
 
@@ -1923,7 +1901,7 @@ elm_store_item_add(Elm_Store *st, Elm_Store_Item_Info *info)
 
    sti = calloc(1, sizeof(Elm_Store_Item));
    if (!sti) return NULL;
-   LKI(sti->lock);
+   eina_lock_new(sti->lock);
    EINA_MAGIC_SET(sti, ELM_STORE_ITEM_MAGIC);
    sti->store = st;
    sti->item_info = info;