jypark pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a6c0e9b06718230d9bfebf8a4eb0fab812ee7458

commit a6c0e9b06718230d9bfebf8a4eb0fab812ee7458
Author: Jiyoun Park <[email protected]>
Date:   Mon Mar 6 12:39:53 2017 +0900

    ecore_evas_extn: add shared lock mode to the ecore_extn.
    
    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.
---
 .../ecore_evas/engines/extn/ecore_evas_extn_buf.c        | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c 
b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c
index 8f28654..158e4c4 100644
--- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c
+++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c
@@ -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;

-- 


Reply via email to