discomfitor pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=44bafb0741f34f51c11627b93d7d2a207f34ace5
commit 44bafb0741f34f51c11627b93d7d2a207f34ace5 Author: Mike Blumenkrantz <[email protected]> Date: Tue Jun 19 13:30:20 2018 -0400 eina: replace memsets in thread debugging lock create/free with manual zeroing Summary: memset overwrites the thread value, triggering errors when running tools like helgrind attempting an operation on an invalid thread will cause errors naturally, so zeroing the rest of the struct and ignoring the thread member is fine Reviewers: ManMower, devilhorns Reviewed By: ManMower Subscribers: cedric, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D6297 --- src/lib/eina/eina_inline_lock_posix.x | 6 ++++++ src/lib/eina/eina_lock.c | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib/eina/eina_inline_lock_posix.x b/src/lib/eina/eina_inline_lock_posix.x index 604a5ac6ab..9dd96ebb4e 100644 --- a/src/lib/eina/eina_inline_lock_posix.x +++ b/src/lib/eina/eina_inline_lock_posix.x @@ -162,6 +162,9 @@ eina_lock_new(Eina_Lock *mutex) Eina_Bool ret = _eina_lock_new(mutex, EINA_FALSE); #ifdef EINA_HAVE_DEBUG_THREADS mutex->recursive = EINA_FALSE; + mutex->lock_thread_id = 0; + mutex->lock_bt_num = 0; + mutex->locked = 0; #endif return ret; } @@ -172,6 +175,9 @@ eina_lock_recursive_new(Eina_Lock *mutex) Eina_Bool ret = _eina_lock_new(mutex, EINA_TRUE); #ifdef EINA_HAVE_DEBUG_THREADS mutex->recursive = EINA_TRUE; + mutex->lock_thread_id = 0; + mutex->lock_bt_num = 0; + mutex->locked = 0; #endif return ret; } diff --git a/src/lib/eina/eina_lock.c b/src/lib/eina/eina_lock.c index 00dc4fd211..9c560df38e 100644 --- a/src/lib/eina/eina_lock.c +++ b/src/lib/eina/eina_lock.c @@ -95,7 +95,6 @@ _eina_lock_new(Eina_Lock *mutex, Eina_Bool recursive) } #ifdef EINA_HAVE_DEBUG_THREADS else if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK) != 0) goto fail_release; - memset(mutex, 0, sizeof(Eina_Lock)); #endif if (pthread_mutex_init(&(mutex->mutex), &attr) != 0) goto fail_release; ok = EINA_TRUE; @@ -111,9 +110,6 @@ _eina_lock_free(Eina_Lock *mutex) ok = pthread_mutex_destroy(&(mutex->mutex)); if (ok != 0) EINA_LOCK_ABORT_DEBUG(ok, mutex_destroy, mutex); -#ifdef EINA_HAVE_DEBUG_THREADS - memset(mutex, 0, sizeof(Eina_Lock)); -#endif } EAPI Eina_Bool @@ -124,7 +120,6 @@ _eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex) #ifdef EINA_HAVE_DEBUG_THREADS assert(mutex != NULL); - memset(cond, 0, sizeof (Eina_Condition)); #endif cond->lock = mutex; @@ -167,9 +162,6 @@ EAPI void _eina_condition_free(Eina_Condition *cond) { pthread_cond_destroy(&(cond->condition)); -#ifdef EINA_HAVE_DEBUG_THREADS - memset(cond, 0, sizeof (Eina_Condition)); -#endif } EAPI Eina_Bool --
