mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
MDEV-17441 - InnoDB transition to C++11 atomics
srv_sys_t::n_threads_active transition to Atomic_counter.
This commit is contained in:
parent
adc30ecab5
commit
28d627392b
1 changed files with 11 additions and 11 deletions
|
@ -596,11 +596,12 @@ struct srv_sys_t{
|
|||
sys_threads[]->event are
|
||||
covered by srv_sys_t::mutex */
|
||||
|
||||
ulint n_threads_active[SRV_MASTER + 1];
|
||||
Atomic_counter<ulint>
|
||||
n_threads_active[SRV_MASTER + 1];
|
||||
/*!< number of threads active
|
||||
in a thread class; protected
|
||||
by both my_atomic_addlint()
|
||||
and mutex */
|
||||
by both std::atomic and
|
||||
mutex */
|
||||
|
||||
srv_stats_t::ulint_ctr_1_t
|
||||
activity_count; /*!< For tracking server
|
||||
|
@ -612,7 +613,7 @@ static srv_sys_t srv_sys;
|
|||
/** @return whether the purge coordinator thread is active */
|
||||
bool purge_sys_t::running()
|
||||
{
|
||||
return my_atomic_loadlint(&srv_sys.n_threads_active[SRV_PURGE]);
|
||||
return srv_sys.n_threads_active[SRV_PURGE];
|
||||
}
|
||||
|
||||
/** Event to signal srv_monitor_thread. Not protected by a mutex.
|
||||
|
@ -811,7 +812,7 @@ srv_reserve_slot(
|
|||
|
||||
ut_ad(srv_slot_get_type(slot) == type);
|
||||
|
||||
my_atomic_addlint(&srv_sys.n_threads_active[type], 1);
|
||||
srv_sys.n_threads_active[type]++;
|
||||
|
||||
srv_sys_mutex_exit();
|
||||
|
||||
|
@ -858,8 +859,7 @@ srv_suspend_thread_low(
|
|||
ut_a(!slot->suspended);
|
||||
slot->suspended = TRUE;
|
||||
|
||||
if (lint(my_atomic_addlint(&srv_sys.n_threads_active[type], ulint(-1)))
|
||||
< 0) {
|
||||
if (srv_sys.n_threads_active[type]-- == 0) {
|
||||
ut_error;
|
||||
}
|
||||
|
||||
|
@ -916,7 +916,7 @@ srv_resume_thread(srv_slot_t* slot, int64_t sig_count = 0, bool wait = true,
|
|||
ut_ad(slot->suspended);
|
||||
|
||||
slot->suspended = FALSE;
|
||||
my_atomic_addlint(&srv_sys.n_threads_active[slot->type], 1);
|
||||
srv_sys.n_threads_active[slot->type]++;
|
||||
srv_sys_mutex_exit();
|
||||
return(timeout);
|
||||
}
|
||||
|
@ -1913,7 +1913,7 @@ srv_active_wake_master_thread_low()
|
|||
|
||||
srv_inc_activity_count();
|
||||
|
||||
if (my_atomic_loadlint(&srv_sys.n_threads_active[SRV_MASTER]) == 0) {
|
||||
if (srv_sys.n_threads_active[SRV_MASTER] == 0) {
|
||||
srv_slot_t* slot;
|
||||
|
||||
srv_sys_mutex_enter();
|
||||
|
@ -1938,7 +1938,7 @@ srv_wake_purge_thread_if_not_active()
|
|||
ut_ad(!srv_sys_mutex_own());
|
||||
|
||||
if (purge_sys.enabled() && !purge_sys.paused()
|
||||
&& !my_atomic_loadlint(&srv_sys.n_threads_active[SRV_PURGE])
|
||||
&& !srv_sys.n_threads_active[SRV_PURGE]
|
||||
&& trx_sys.rseg_history_len) {
|
||||
|
||||
srv_release_threads(SRV_PURGE, 1);
|
||||
|
@ -2481,7 +2481,7 @@ DECLARE_THREAD(srv_worker_thread)(
|
|||
slot = srv_reserve_slot(SRV_WORKER);
|
||||
|
||||
ut_a(srv_n_purge_threads > 1);
|
||||
ut_a(ulong(my_atomic_loadlint(&srv_sys.n_threads_active[SRV_WORKER]))
|
||||
ut_a(ulong(srv_sys.n_threads_active[SRV_WORKER])
|
||||
< srv_n_purge_threads);
|
||||
|
||||
/* We need to ensure that the worker threads exit after the
|
||||
|
|
Loading…
Add table
Reference in a new issue