ecore_evas_extn: add shared lock mode to the ecore_extn.
authorJiyoun Park <jy0703.park@samsung.com>
Mon, 6 Mar 2017 03:39:53 +0000 (12:39 +0900)
committerJiyoun Park <jy0703.park@samsung.com>
Mon, 6 Mar 2017 03:39:53 +0000 (12:39 +0900)
Currently, ecore_evas_extn only use exclusive lock.
so if there are many ecore_extn_plugs , there is competition among the ecore_extn_plugs.
since the ecore_extn_plugs dont need to use exclusive lock, add the shred lock mode.

src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c

index 8f28654..158e4c4 100644 (file)
@@ -123,7 +123,13 @@ _extnbuf_lock(Extnbuf *b, int *w, int *h, int *stride)
      {
         if (b->lockfd >= 0)
           {
-             if (lockf(b->lockfd, F_LOCK, 0) < 0)
+             struct flock filelock;
+
+             filelock.l_type = b->am_owner ? F_WRLCK : F_RDLCK;
+             filelock.l_whence = SEEK_SET;
+             filelock.l_start = 0;
+             filelock.l_len = 0;
+             if (fcntl(b->lockfd, F_SETLKW, &filelock) == -1)
                {
                   ERR("lock take fail");
                   return NULL;
@@ -140,7 +146,13 @@ _extnbuf_unlock(Extnbuf *b)
    if (!b || !b->have_lock) return;
    if (b->lockfd >= 0)
      {
-        if (lockf(b->lockfd, F_ULOCK, 0) < 0)
+        struct flock filelock;
+
+        filelock.l_type = F_UNLCK;
+        filelock.l_whence = SEEK_SET;
+        filelock.l_start = 0;
+        filelock.l_len = 0;
+        if (fcntl(b->lockfd, F_SETLKW, &filelock) == -1)
           {
              ERR("lock release fail");
              return;