diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2012-02-17 23:33:18 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2012-02-17 23:33:18 +0100 |
commit | 58c3e32dbdd43e8635c0320fcf5cc744e354fc65 (patch) | |
tree | f36d1fa78e3336d6143c6a3e7029e9bbf9acd2a7 /sql/sql_class.cc | |
parent | 2a5d8ea9a201a1bf33fe309b8293e31ebd961e60 (diff) | |
download | mariadb-git-58c3e32dbdd43e8635c0320fcf5cc744e354fc65.tar.gz |
Simplify thd_wait_begin. given how seldom they are called, calling current_thd one more time is not going to be anything performance relevant.
Also use thd_wait_begin/end for thr_lock and sync callbacks.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index af3cdf7b34f..b174c3b4b55 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3935,13 +3935,10 @@ extern "C" bool thd_sqlcom_can_generate_row_events(const MYSQL_THD thd) */ extern "C" void thd_wait_begin(MYSQL_THD thd, int wait_type) { - - if (unlikely(!thread_scheduler) || !thread_scheduler->thd_wait_begin) - return; - if (thd == NULL) + if (!thd) { - thd=current_thd; - if(unlikely(thd == NULL)) + thd= current_thd; + if (unlikely(!thd)) return; } MYSQL_CALLBACK(thd->scheduler, thd_wait_begin, (thd, wait_type)); @@ -3956,16 +3953,13 @@ extern "C" void thd_wait_begin(MYSQL_THD thd, int wait_type) */ extern "C" void thd_wait_end(MYSQL_THD thd) { - if (unlikely(!thread_scheduler) || ! thread_scheduler->thd_wait_begin) - return; - if (thd == NULL) + if (!thd) { - thd=current_thd; - if(unlikely(thd == NULL)) + thd= current_thd; + if (unlikely(!thd)) return; } - if(likely(thd->scheduler == thread_scheduler)) - thread_scheduler->thd_wait_end(thd); + MYSQL_CALLBACK(thd->scheduler, thd_wait_end, (thd)); } #endif // INNODB_COMPATIBILITY_HOOKS */ |