discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=83bab7cab40099d0e46a78bf33dcad4c732f7ea5

commit 83bab7cab40099d0e46a78bf33dcad4c732f7ea5
Author: Mike Blumenkrantz <[email protected]>
Date:   Mon Jun 25 15:18:11 2018 -0400

    eina/lock: add errno wrapping for backtrace() calls in thread debug blocks
    
    Summary:
    somehow backtrace() is able to generate EINVAL in certain cases even though
    this is not documented anywhere. these irrelevant errors should not be 
noticed
    by users of the api during debugging, as this can cause some tests/apps to
    randomly fail without explanation
    
    @fix
    
    Reviewers: ManMower, devilhorns
    
    Reviewed By: ManMower
    
    Subscribers: cedric, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D6377
---
 src/lib/eina/eina_inline_lock_posix.x | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lib/eina/eina_inline_lock_posix.x 
b/src/lib/eina/eina_inline_lock_posix.x
index 625441accf..911b5c1f3b 100644
--- a/src/lib/eina/eina_inline_lock_posix.x
+++ b/src/lib/eina/eina_inline_lock_posix.x
@@ -225,7 +225,10 @@ eina_lock_take_try(Eina_Lock *mutex)
         if (mutex->recursive) return ret;
         mutex->locked = 1;
         mutex->lock_thread_id = pthread_self();
+        /* backtrace() can somehow generate EINVAL even though this is not 
documented anywhere? */
+        int err = errno;
         mutex->lock_bt_num = backtrace((void **)(mutex->lock_bt), 
EINA_LOCK_DEBUG_BT_NUM);
+        errno = err;
 
         pthread_mutex_lock(&_eina_tracking_lock);
         _eina_tracking = eina_inlist_append(_eina_tracking,
@@ -295,7 +298,10 @@ eina_lock_take(Eina_Lock *mutex)
    if (mutex->recursive) return ret;
    mutex->locked = 1;
    mutex->lock_thread_id = pthread_self();
+   /* backtrace() can somehow generate EINVAL even though this is not 
documented anywhere? */
+   int err = errno;
    mutex->lock_bt_num = backtrace((void **)(mutex->lock_bt), 
EINA_LOCK_DEBUG_BT_NUM);
+   errno = err;
 
    pthread_mutex_lock(&_eina_tracking_lock);
    _eina_tracking = eina_inlist_append(_eina_tracking,

-- 


Reply via email to