diff options
-rw-r--r-- | sql/scheduler.cc | 18 | ||||
-rw-r--r-- | sql/sql_class.cc | 20 |
2 files changed, 12 insertions, 26 deletions
diff --git a/sql/scheduler.cc b/sql/scheduler.cc index 3f779337345..720b0d812cc 100644 --- a/sql/scheduler.cc +++ b/sql/scheduler.cc @@ -46,28 +46,20 @@ static bool no_threads_end(THD *thd, bool put_in_cache) /**@{*/ extern "C" { -static void scheduler_wait_lock_begin(void) { - THD *thd=current_thd; - if(thd) - MYSQL_CALLBACK(thd->scheduler, thd_wait_begin, (thd, THD_WAIT_TABLE_LOCK)); +static void scheduler_wait_lock_begin(void) { + thd_wait_begin(NULL, THD_WAIT_TABLE_LOCK); } static void scheduler_wait_lock_end(void) { - THD *thd=current_thd; - if(thd) - MYSQL_CALLBACK(thd->scheduler, thd_wait_end, (thd)); + thd_wait_end(NULL); } static void scheduler_wait_sync_begin(void) { - THD *thd=current_thd; - if(thd) - MYSQL_CALLBACK(thd->scheduler, thd_wait_begin, (thd, THD_WAIT_TABLE_LOCK)); + thd_wait_begin(NULL, THD_WAIT_SYNC); } static void scheduler_wait_sync_end(void) { - THD *thd=current_thd; - if(thd) - MYSQL_CALLBACK(thd->scheduler, thd_wait_end, (thd)); + thd_wait_end(NULL); } }; /**@}*/ 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 */ |