From 4dff0296f402ff4fa6ee69e0411b8136eb5cd816 Mon Sep 17 00:00:00 2001 From: Mikael Ronstrom Date: Wed, 27 Oct 2010 20:29:09 +0200 Subject: Added more wait states for THD wait service --- sql/item_func.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql/item_func.cc') diff --git a/sql/item_func.cc b/sql/item_func.cc index 6699b2820e6..e20cae16094 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -52,6 +52,8 @@ #include "sp.h" #include "set_var.h" #include "debug_sync.h" +#include +#include #ifdef NO_EMBEDDED_ACCESS_CHECKS #define sp_restore_security_context(A,B) while (0) {} @@ -3802,7 +3804,9 @@ longlong Item_func_get_lock::val_int() while (ull->locked && !thd->killed) { DBUG_PRINT("info", ("waiting on lock")); + thd_wait_begin(thd, THD_WAIT_USER_LOCK); error= interruptible_wait(thd, &ull->cond, &LOCK_user_locks, timeout); + thd_wait_end(thd); if (error == ETIMEDOUT || error == ETIME) { DBUG_PRINT("info", ("lock wait timeout")); @@ -4026,7 +4030,9 @@ longlong Item_func_sleep::val_int() error= 0; while (!thd->killed) { + thd_wait_begin(thd, THD_WAIT_SLEEP); error= interruptible_wait(thd, &cond, &LOCK_user_locks, timeout); + thd_wait_end(thd); if (error == ETIMEDOUT || error == ETIME) break; error= 0; -- cgit v1.2.1 From b14adc3921d3f2e30f858a31ae73ecdc65901e54 Mon Sep 17 00:00:00 2001 From: Mikael Ronstrom Date: Fri, 4 Mar 2011 13:12:31 +0100 Subject: More review fixes --- sql/item_func.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sql/item_func.cc') diff --git a/sql/item_func.cc b/sql/item_func.cc index 9195cf4f8c7..a149bb7f955 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3877,12 +3877,11 @@ longlong Item_func_get_lock::val_int() timed_cond.set_timeout(timeout * ULL(1000000000)); error= 0; + thd_wait_begin(thd, THD_WAIT_USER_LOCK); while (ull->locked && !thd->killed) { DBUG_PRINT("info", ("waiting on lock")); - thd_wait_begin(thd, THD_WAIT_USER_LOCK); error= timed_cond.wait(&ull->cond, &LOCK_user_locks); - thd_wait_end(thd); if (error == ETIMEDOUT || error == ETIME) { DBUG_PRINT("info", ("lock wait timeout")); @@ -3890,6 +3889,7 @@ longlong Item_func_get_lock::val_int() } error= 0; } + thd_wait_end(thd); if (ull->locked) { @@ -4107,15 +4107,15 @@ longlong Item_func_sleep::val_int() thd->mysys_var->current_cond= &cond; error= 0; + thd_wait_begin(thd, THD_WAIT_SLEEP); while (!thd->killed) { - thd_wait_begin(thd, THD_WAIT_SLEEP); error= timed_cond.wait(&cond, &LOCK_user_locks); - thd_wait_end(thd); if (error == ETIMEDOUT || error == ETIME) break; error= 0; } + thd_wait_end(thd); thd_proc_info(thd, 0); mysql_mutex_unlock(&LOCK_user_locks); mysql_mutex_lock(&thd->mysys_var->mutex); -- cgit v1.2.1