summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-05-09 15:14:04 +0300
committerMichael Widenius <monty@askmonty.org>2011-05-09 15:14:04 +0300
commit82b49178600e3b21f378bef71b8f9e81bc7bcd3a (patch)
tree2229342bc1cd1d19278e40edc478851b81d65520 /sql
parent65d1eda8685bc265c6d0f3b70922929897fc4ddd (diff)
downloadmariadb-git-82b49178600e3b21f378bef71b8f9e81bc7bcd3a.tar.gz
Make event stop code even more robust.
(Test failed if we added my_sleep(200000) in event_queue::cond_wait() just before pthread_cond_wait(); Not likely scenario but better to get that fixed too)
Diffstat (limited to 'sql')
-rwxr-xr-xsql/event_scheduler.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index 4d6636eedb2..ecddcb7ca46 100755
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -648,7 +648,14 @@ Event_scheduler::stop()
/* thd could be 0x0, when shutting down */
sql_print_information("Event Scheduler: "
"Waiting for the scheduler thread to reply");
- COND_STATE_WAIT(thd, NULL, "Waiting scheduler to stop");
+
+ /*
+ Wait only 2 seconds, as there is a small chance the thread missed the
+ above awake() call and we may have to do it again
+ */
+ struct timespec top_time;
+ set_timespec(top_time, 2);
+ COND_STATE_WAIT(thd, &top_time, "Waiting scheduler to stop");
} while (state == STOPPING);
DBUG_PRINT("info", ("Scheduler thread has cleaned up. Set state to INIT"));
sql_print_information("Event Scheduler: Stopped");