Commit 8cad8f9b authored by unknown's avatar unknown
Browse files

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 a6933a63
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -731,7 +731,8 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data)
    if (queue.elements)
    {
      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;
    }
@@ -747,7 +748,7 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data)
      else
      {
        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__);