1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Vladislav Vaintroub
2012-02-17 23:33:18 +01:00
parent 2a5d8ea9a2
commit 58c3e32dbd
2 changed files with 12 additions and 26 deletions

View File

@ -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 */