diff options
author | Igor Babaev <igor@askmonty.org> | 2019-02-06 18:01:29 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2019-02-06 18:01:29 -0800 |
commit | 3f9040085a0de4976f55bc7e4a2fa5fa8d923100 (patch) | |
tree | cefa82212b688d12a7ca180f7a0a8f32715e2a79 /sql/event_scheduler.cc | |
parent | 16327fc2e76e9215059894b461e8aca7f989da00 (diff) | |
parent | e80bcd7f64fc8ff6f46c1fc0d01e9c0b0fd03064 (diff) | |
download | mariadb-git-3f9040085a0de4976f55bc7e4a2fa5fa8d923100.tar.gz |
Merge branch '10.4' into bb-10.4-mdev17096
Diffstat (limited to 'sql/event_scheduler.cc')
-rw-r--r-- | sql/event_scheduler.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index f459fd34aee..99b3c9b93fb 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -150,7 +150,7 @@ deinit_event_thread(THD *thd) { thd->proc_info= "Clearing"; DBUG_PRINT("exit", ("Event thread finishing")); - unlink_not_visible_thd(thd); + server_threads.erase(thd); delete thd; } @@ -185,7 +185,7 @@ pre_init_event_thread(THD* thd) thd->net.read_timeout= slave_net_timeout; thd->variables.option_bits|= OPTION_AUTO_IS_NULL; thd->client_capabilities|= CLIENT_MULTI_RESULTS; - add_to_active_threads(thd); + server_threads.insert(thd); /* Guarantees that we will see the thread in SHOW PROCESSLIST though its @@ -679,20 +679,20 @@ end: Event_scheduler::workers_count() */ +static my_bool workers_count_callback(THD *thd, uint32_t *count) +{ + if (thd->system_thread == SYSTEM_THREAD_EVENT_WORKER) + ++*count; + return 0; +} + + uint Event_scheduler::workers_count() { - THD *tmp; - uint count= 0; - + uint32_t count= 0; DBUG_ENTER("Event_scheduler::workers_count"); - mysql_mutex_lock(&LOCK_thread_count); // For unlink from list - I_List_iterator<THD> it(threads); - while ((tmp=it++)) - if (tmp->system_thread == SYSTEM_THREAD_EVENT_WORKER) - ++count; - mysql_mutex_unlock(&LOCK_thread_count); - DBUG_PRINT("exit", ("%d", count)); + server_threads.iterate(workers_count_callback, &count); DBUG_RETURN(count); } |