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.
This commit is contained in:
Jiyoun Park 2017-03-06 12:39:53 +09:00
parent c19d3b402a
commit a6c0e9b067
1 changed files with 14 additions and 2 deletions

View 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;