diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/my_pthread.h | 10 | ||||
-rw-r--r-- | include/mysql/psi/mysql_thread.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h index 4888bfcc2c8..66876032178 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -427,12 +427,10 @@ void safe_mutex_free_deadlock_data(safe_mutex_t *mp); #define MYF_NO_DEADLOCK_DETECTION 2 #ifdef SAFE_MUTEX -#define safe_mutex_assert_owner(mp) \ - DBUG_ASSERT((mp)->count > 0 && \ - pthread_equal(pthread_self(), (mp)->thread)) -#define safe_mutex_assert_not_owner(mp) \ - DBUG_ASSERT(! (mp)->count || \ - ! pthread_equal(pthread_self(), (mp)->thread)) +#define safe_mutex_is_owner(mp) ((mp)->count > 0 && \ + pthread_equal(pthread_self(), (mp)->thread)) +#define safe_mutex_assert_owner(mp) DBUG_ASSERT(safe_mutex_is_owner(mp)) +#define safe_mutex_assert_not_owner(mp) DBUG_ASSERT(!safe_mutex_is_owner(mp)) #define safe_mutex_setflags(mp, F) do { (mp)->create_flags|= (F); } while (0) #define my_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__) #define my_cond_wait(A,B) safe_cond_wait((A), (B), __FILE__, __LINE__) diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h index 711520dba78..47f89f76685 100644 --- a/include/mysql/psi/mysql_thread.h +++ b/include/mysql/psi/mysql_thread.h @@ -1,4 +1,5 @@ /* Copyright (c) 2008, 2013, Oracle and/or its affiliates. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, @@ -262,6 +263,7 @@ typedef struct st_mysql_cond mysql_cond_t; */ #ifndef DISABLE_MYSQL_THREAD_H +#define mysql_mutex_is_owner(M) safe_mutex_is_owner(&(M)->m_mutex) /** @def mysql_mutex_assert_owner(M) Wrapper, to use safe_mutex_assert_owner with instrumented mutexes. |