eina_lock: remove safety checks for main thread
Summary: these effectively prevent locks from being used to synchronize operations between (non-main) threads, which restricts their usefulness and also prevents our own unit tests from passing fix T7004 Depends on D6267 Reviewers: devilhorns, ManMower Reviewed By: ManMower Subscribers: cedric, #committers Tags: #efl Maniphest Tasks: T7004, T1984 Differential Revision: https://phab.enlightenment.org/D6285
This commit is contained in:
parent
8ef0cd0950
commit
032e4bd116
|
@ -200,9 +200,6 @@ eina_lock_take(Eina_Lock *mutex)
|
|||
#ifdef EINA_HAVE_ON_OFF_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
{
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
return EINA_LOCK_SUCCEED;
|
||||
}
|
||||
#endif
|
||||
|
@ -270,18 +267,10 @@ eina_lock_take_try(Eina_Lock *mutex)
|
|||
#ifdef EINA_HAVE_ON_OFF_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
{
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
return EINA_LOCK_SUCCEED;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
|
||||
ok = pthread_mutex_trylock(&(mutex->mutex));
|
||||
if (ok == 0) ret = EINA_LOCK_SUCCEED;
|
||||
else if (ok == EDEADLK)
|
||||
|
@ -317,9 +306,6 @@ eina_lock_release(Eina_Lock *mutex)
|
|||
#ifdef EINA_HAVE_ON_OFF_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
{
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
return EINA_LOCK_SUCCEED;
|
||||
}
|
||||
#endif
|
||||
|
@ -506,9 +492,6 @@ eina_rwlock_take_read(Eina_RWLock *mutex)
|
|||
#ifdef EINA_HAVE_ON_OFF_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
{
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
return EINA_LOCK_SUCCEED;
|
||||
}
|
||||
#endif
|
||||
|
@ -529,9 +512,6 @@ eina_rwlock_take_write(Eina_RWLock *mutex)
|
|||
#ifdef EINA_HAVE_ON_OFF_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
{
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
return EINA_LOCK_SUCCEED;
|
||||
}
|
||||
#endif
|
||||
|
@ -552,9 +532,6 @@ eina_rwlock_release(Eina_RWLock *mutex)
|
|||
#ifdef EINA_HAVE_ON_OFF_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
{
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
return EINA_LOCK_SUCCEED;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -88,11 +88,6 @@ _eina_lock_new(Eina_Lock *mutex, Eina_Bool recursive)
|
|||
pthread_mutexattr_t attr;
|
||||
Eina_Bool ok = EINA_FALSE;
|
||||
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
|
||||
if (pthread_mutexattr_init(&attr) != 0) return EINA_FALSE;
|
||||
if (recursive)
|
||||
{
|
||||
|
@ -114,11 +109,6 @@ _eina_lock_free(Eina_Lock *mutex)
|
|||
{
|
||||
int ok;
|
||||
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
|
||||
ok = pthread_mutex_destroy(&(mutex->mutex));
|
||||
if (ok != 0) EINA_LOCK_ABORT_DEBUG(ok, mutex_destroy, mutex);
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
|
@ -134,8 +124,6 @@ _eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex)
|
|||
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
assert(mutex != NULL);
|
||||
if (!_eina_threads_activated)
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
memset(cond, 0, sizeof (Eina_Condition));
|
||||
#endif
|
||||
|
||||
|
@ -178,11 +166,6 @@ _eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex)
|
|||
EAPI void
|
||||
_eina_condition_free(Eina_Condition *cond)
|
||||
{
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
|
||||
pthread_cond_destroy(&(cond->condition));
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
memset(cond, 0, sizeof (Eina_Condition));
|
||||
|
@ -194,11 +177,6 @@ _eina_rwlock_new(Eina_RWLock *mutex)
|
|||
{
|
||||
int ok;
|
||||
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
|
||||
ok = pthread_rwlock_init(&(mutex->mutex), NULL);
|
||||
if (ok == 0) return EINA_TRUE;
|
||||
else if ((ok == EAGAIN) || (ok == ENOMEM)) return EINA_FALSE;
|
||||
|
@ -209,10 +187,6 @@ _eina_rwlock_new(Eina_RWLock *mutex)
|
|||
EAPI void
|
||||
_eina_rwlock_free(Eina_RWLock *mutex)
|
||||
{
|
||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||
if (!_eina_threads_activated)
|
||||
assert(pthread_equal(_eina_main_loop, pthread_self()));
|
||||
#endif
|
||||
pthread_rwlock_destroy(&(mutex->mutex));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue