Commit c16b2429 authored by Nikita Malyavin's avatar Nikita Malyavin

wake up from sleep

parent d8c908bb
......@@ -147,6 +147,21 @@ WHERE variable_name = "time_zone";
current variable_value
1 +02:00
0 SYSTEM
# Test sleep
connect con_sleep, localhost, root,,;
set debug_sync= "func_sleep_locked SIGNAL lock WAIT_FOR goon";
select sleep(3);
connection default;
set debug_sync= "now WAIT_FOR lock";
set debug_sync= "apc_after_notify SIGNAL goon";
SELECT thread_id = @def_thread_id as current, variable_value
FROM performance_schema.variables_by_thread
WHERE variable_name = "time_zone";
current variable_value
1 +02:00
0 SYSTEM
0 SYSTEM
disconnect con_sleep;
# Cleanup
connection default;
set debug_sync= "reset";
......
......@@ -149,6 +149,19 @@ SELECT thread_id = @def_thread_id as current, variable_value
FROM performance_schema.variables_by_thread
WHERE variable_name = "time_zone";
--echo # Test sleep
--connect (con_sleep, localhost, root,,)
set debug_sync= "func_sleep_locked SIGNAL lock WAIT_FOR goon";
send select sleep(3);
--connection default
set debug_sync= "now WAIT_FOR lock";
set debug_sync= "apc_after_notify SIGNAL goon";
SELECT thread_id = @def_thread_id as current, variable_value
FROM performance_schema.variables_by_thread
WHERE variable_name = "time_zone";
--disconnect con_sleep
--echo # Cleanup
--connection default
......
......@@ -4584,13 +4584,14 @@ longlong Item_func_sleep::val_int()
mysql_cond_init(key_item_func_sleep_cond, &cond, NULL);
mysql_mutex_lock(&LOCK_item_func_sleep);
DEBUG_SYNC(thd, "func_sleep_locked");
THD_STAGE_INFO(thd, stage_user_sleep);
thd->mysys_var->current_mutex= &LOCK_item_func_sleep;
thd->mysys_var->current_cond= &cond;
error= 0;
thd_wait_begin(thd, THD_WAIT_SLEEP);
while (!thd->killed)
while (!thd->check_killed(true))
{
error= timed_cond.wait(&cond, &LOCK_item_func_sleep);
if (error == ETIMEDOUT || error == ETIME)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment