Commit da945b0e authored by unknown's avatar unknown

Calculate offset for wait time passed to set_timespec

Pass different msg if waiting on empty queue


sql/event_queue.cc:
  Calculate offset for wait time passed to set_timespec instead of
  the "absolute time" from execute_at
  Pass different msg if waiting on empty queue
parent 5037af16
...@@ -731,7 +731,8 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data) ...@@ -731,7 +731,8 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data)
if (queue.elements) if (queue.elements)
{ {
top= ((Event_queue_element*) queue_element(&queue, 0)); top= ((Event_queue_element*) queue_element(&queue, 0));
set_timespec(top_time, sec_since_epoch_TIME(&top->execute_at)); set_timespec(top_time,
sec_since_epoch_TIME(&top->execute_at) - now);
abstime= &top_time; abstime= &top_time;
} }
...@@ -747,7 +748,7 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data) ...@@ -747,7 +748,7 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data)
else else
{ {
set_zero_time(&next_activation_at, MYSQL_TIMESTAMP_DATETIME); set_zero_time(&next_activation_at, MYSQL_TIMESTAMP_DATETIME);
msg= queue_wait_msg; msg= queue_empty_msg;
} }
cond_wait(thd, abstime, msg, SCHED_FUNC, __LINE__); cond_wait(thd, abstime, msg, SCHED_FUNC, __LINE__);
......
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