summaryrefslogtreecommitdiff
path: root/sql/event_scheduler.cc
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2009-10-13 22:29:28 +0400
committerKonstantin Osipov <kostja@sun.com>2009-10-13 22:29:28 +0400
commit3dd1d5983b13be1f87a4da82cc89140605e9714d (patch)
tree40a573389e4d5eb1381ef8264dc76b4f3d0d40de /sql/event_scheduler.cc
parentea6a22bfa816ebc373316eee36c18952e812e7f6 (diff)
downloadmariadb-git-3dd1d5983b13be1f87a4da82cc89140605e9714d.tar.gz
Backport of the following revision from 6.0-codebase:
---------------------------------------------------------- revno: 2617.1.12 committer: kostja@bodhi.(none) timestamp: Sun 2008-04-20 11:18:52 +0400 message: A fix for Bug#32771 "events_bugs.test fails randomly". In Event_scheduler::stop(), which may be called from destructor, wait synchronously for the parallel Event_scheduler::stop() to complete before returning. This fixes a race between MySQL shutdown thread and the scheduler thread who could call stop() in parallel.
Diffstat (limited to 'sql/event_scheduler.cc')
-rw-r--r--sql/event_scheduler.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index daaa6be0520..ea20270b457 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -607,7 +607,12 @@ Event_scheduler::stop()
LOCK_DATA();
DBUG_PRINT("info", ("state before action %s", scheduler_states_names[state].str));
if (state != RUNNING)
+ {
+ /* Synchronously wait until the scheduler stops. */
+ while (state != INITIALIZED)
+ COND_STATE_WAIT(thd, NULL, "Waiting for the scheduler to stop");
goto end;
+ }
/* Guarantee we don't catch spurious signals */
do {