summaryrefslogtreecommitdiff
path: root/sql/debug_sync.cc
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@dator8>2010-11-09 16:33:40 +0100
committerMikael Ronstrom <mikael@dator8>2010-11-09 16:33:40 +0100
commit6a7151903f2338bb2f89fdc48f2ff21e085f4bae (patch)
tree51e90489748e0801463310eb17943e447d936382 /sql/debug_sync.cc
parentc0854c3e1746f81abcba27505c7f8adc09ff2c45 (diff)
downloadmariadb-git-6a7151903f2338bb2f89fdc48f2ff21e085f4bae.tar.gz
Added support in DEBUG_SYNC framework for actions when THD object isn't actively executed, that is when mysys_var == NULL
Diffstat (limited to 'sql/debug_sync.cc')
-rw-r--r--sql/debug_sync.cc28
1 files changed, 19 insertions, 9 deletions
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index 74e5b2c70f3..1390bac8352 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -1746,10 +1746,15 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
mutex and cond. This would prohibit the use of DEBUG_SYNC
between other places of enter_cond() and exit_cond().
*/
- old_mutex= thd->mysys_var->current_mutex;
- old_cond= thd->mysys_var->current_cond;
- thd->mysys_var->current_mutex= &debug_sync_global.ds_mutex;
- thd->mysys_var->current_cond= &debug_sync_global.ds_cond;
+ if (thd->mysys_var)
+ {
+ old_mutex= thd->mysys_var->current_mutex;
+ old_cond= thd->mysys_var->current_cond;
+ thd->mysys_var->current_mutex= &debug_sync_global.ds_mutex;
+ thd->mysys_var->current_cond= &debug_sync_global.ds_cond;
+ }
+ else
+ old_mutex= NULL;
set_timespec(abstime, action->timeout);
DBUG_EXECUTE("debug_sync_exec", {
@@ -1804,11 +1809,16 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
is locked. (See comment in THD::exit_cond().)
*/
mysql_mutex_unlock(&debug_sync_global.ds_mutex);
- mysql_mutex_lock(&thd->mysys_var->mutex);
- thd->mysys_var->current_mutex= old_mutex;
- thd->mysys_var->current_cond= old_cond;
- thd_proc_info(thd, old_proc_info);
- mysql_mutex_unlock(&thd->mysys_var->mutex);
+ if (old_mutex)
+ {
+ mysql_mutex_lock(&thd->mysys_var->mutex);
+ thd->mysys_var->current_mutex= old_mutex;
+ thd->mysys_var->current_cond= old_cond;
+ thd_proc_info(thd, old_proc_info);
+ mysql_mutex_unlock(&thd->mysys_var->mutex);
+ }
+ else
+ thd_proc_info(thd, old_proc_info);
}
else
{