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:
parent
c19d3b402a
commit
a6c0e9b067
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue