summaryrefslogtreecommitdiff
path: root/sql/event_scheduler.cc
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2009-11-20 16:23:32 +0100
committerMikael Ronstrom <mikael@mysql.com>2009-11-20 16:23:32 +0100
commitb6c1ecb37fb0c41bc68cd4e415a96e2e7444d9fc (patch)
tree9d80d5940185d560df7b1affaf54df9fd56d371e /sql/event_scheduler.cc
parent5aeeaaf507ac87f6ff56806fe8a356cea7d4a48f (diff)
parent73f9d9c3718be5e2a137c054f9eeeee5da823373 (diff)
downloadmariadb-git-b6c1ecb37fb0c41bc68cd4e415a96e2e7444d9fc.tar.gz
WL#5138 merged to mysql-next-mr
Diffstat (limited to 'sql/event_scheduler.cc')
-rw-r--r--sql/event_scheduler.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index ea20270b457..880bccdd67e 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -133,9 +133,10 @@ post_init_event_thread(THD *thd)
pthread_mutex_lock(&LOCK_thread_count);
threads.append(thd);
thread_count++;
- thread_running++;
pthread_mutex_unlock(&LOCK_thread_count);
-
+ my_atomic_rwlock_wrlock(&global_query_id_lock);
+ inc_thread_running();
+ my_atomic_rwlock_wrunlock(&global_query_id_lock);
return FALSE;
}
@@ -157,10 +158,12 @@ deinit_event_thread(THD *thd)
DBUG_PRINT("exit", ("Event thread finishing"));
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
- thread_running--;
delete thd;
pthread_cond_broadcast(&COND_thread_count);
pthread_mutex_unlock(&LOCK_thread_count);
+ my_atomic_rwlock_wrlock(&global_query_id_lock);
+ dec_thread_running();
+ my_atomic_rwlock_wrunlock(&global_query_id_lock);
}
@@ -418,10 +421,12 @@ Event_scheduler::start()
net_end(&new_thd->net);
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
- thread_running--;
delete new_thd;
pthread_cond_broadcast(&COND_thread_count);
pthread_mutex_unlock(&LOCK_thread_count);
+ my_atomic_rwlock_wrlock(&global_query_id_lock);
+ dec_thread_running();
+ my_atomic_rwlock_wrunlock(&global_query_id_lock);
}
end:
UNLOCK_DATA();
@@ -551,10 +556,12 @@ error:
net_end(&new_thd->net);
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
- thread_running--;
delete new_thd;
pthread_cond_broadcast(&COND_thread_count);
pthread_mutex_unlock(&LOCK_thread_count);
+ my_atomic_rwlock_wrlock(&global_query_id_lock);
+ dec_thread_running();
+ my_atomic_rwlock_wrunlock(&global_query_id_lock);
}
delete event_name;
DBUG_RETURN(TRUE);