forked from enlightenment/efl
eina: that stuff was just for adding a bug in fact.
This commit is contained in:
parent
875e7cf74d
commit
68a4e85483
|
@ -600,27 +600,16 @@ static inline Eina_Lock_Result
|
||||||
eina_spinlock_take(Eina_Spinlock *spinlock)
|
eina_spinlock_take(Eina_Spinlock *spinlock)
|
||||||
{
|
{
|
||||||
#ifdef EINA_HAVE_POSIX_SPINLOCK
|
#ifdef EINA_HAVE_POSIX_SPINLOCK
|
||||||
Eina_Bool yield;
|
|
||||||
int t;
|
int t;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
yield = EINA_FALSE;
|
|
||||||
|
|
||||||
t = pthread_spin_trylock(spinlock);
|
t = pthread_spin_trylock(spinlock);
|
||||||
if (t != 0)
|
if (t != 0)
|
||||||
{
|
{
|
||||||
if (errno == EBUSY)
|
if (errno == EBUSY) sched_yield();
|
||||||
{
|
else if (errno == EDEADLK) return EINA_LOCK_DEADLOCK;
|
||||||
sched_yield();
|
|
||||||
yield = EINA_TRUE;
|
|
||||||
}
|
|
||||||
else if (errno == EDEADLK)
|
|
||||||
{
|
|
||||||
return EINA_LOCK_DEADLOCK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} while (t != 0);
|
||||||
} while (t != 0 && yield);
|
|
||||||
|
|
||||||
return t ? EINA_LOCK_FAIL : EINA_LOCK_SUCCEED;
|
return t ? EINA_LOCK_FAIL : EINA_LOCK_SUCCEED;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue