|
1 | 1 | #ifndef THR_MUTEX_INCLUDED
|
2 | 2 | #define THR_MUTEX_INCLUDED
|
3 | 3 |
|
4 |
| -/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. |
| 4 | +/* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. |
5 | 5 |
|
6 | 6 | This program is free software; you can redistribute it and/or modify
|
7 | 7 | it under the terms of the GNU General Public License, version 2.0,
|
@@ -145,14 +145,18 @@ int safe_mutex_lock(safe_mutex_t *mp, bool try_lock, const char *file,
|
145 | 145 | int safe_mutex_unlock(safe_mutex_t *mp, const char *file, uint line);
|
146 | 146 | int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line);
|
147 | 147 |
|
148 |
| -static inline void safe_mutex_assert_owner(const safe_mutex_t *mp) { |
| 148 | +static inline void safe_mutex_assert_owner(safe_mutex_t *mp) { |
149 | 149 | DBUG_ASSERT(mp != NULL);
|
| 150 | + native_mutex_lock(&mp->global); |
150 | 151 | DBUG_ASSERT(mp->count > 0 && my_thread_equal(my_thread_self(), mp->thread));
|
| 152 | + native_mutex_unlock(&mp->global); |
151 | 153 | }
|
152 | 154 |
|
153 |
| -static inline void safe_mutex_assert_not_owner(const safe_mutex_t *mp) { |
| 155 | +static inline void safe_mutex_assert_not_owner(safe_mutex_t *mp) { |
154 | 156 | DBUG_ASSERT(mp != NULL);
|
| 157 | + native_mutex_lock(&mp->global); |
155 | 158 | DBUG_ASSERT(!mp->count || !my_thread_equal(my_thread_self(), mp->thread));
|
| 159 | + native_mutex_unlock(&mp->global); |
156 | 160 | }
|
157 | 161 | #endif /* SAFE_MUTEX */
|
158 | 162 |
|
|
0 commit comments