Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
28d62739
Commit
28d62739
authored
Dec 28, 2018
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17441 - InnoDB transition to C++11 atomics
srv_sys_t::n_threads_active transition to Atomic_counter.
parent
adc30eca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
storage/innobase/srv/srv0srv.cc
storage/innobase/srv/srv0srv.cc
+11
-11
No files found.
storage/innobase/srv/srv0srv.cc
View file @
28d62739
...
@@ -596,11 +596,12 @@ struct srv_sys_t{
...
@@ -596,11 +596,12 @@ struct srv_sys_t{
sys_threads[]->event are
sys_threads[]->event are
covered by srv_sys_t::mutex */
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
/*!< number of threads active
in a thread class; protected
in a thread class; protected
by both
my_atomic_addlint()
by both
std::atomic and
and
mutex */
mutex */
srv_stats_t
::
ulint_ctr_1_t
srv_stats_t
::
ulint_ctr_1_t
activity_count
;
/*!< For tracking server
activity_count
;
/*!< For tracking server
...
@@ -612,7 +613,7 @@ static srv_sys_t srv_sys;
...
@@ -612,7 +613,7 @@ static srv_sys_t srv_sys;
/** @return whether the purge coordinator thread is active */
/** @return whether the purge coordinator thread is active */
bool
purge_sys_t
::
running
()
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.
/** Event to signal srv_monitor_thread. Not protected by a mutex.
...
@@ -811,7 +812,7 @@ srv_reserve_slot(
...
@@ -811,7 +812,7 @@ srv_reserve_slot(
ut_ad
(
srv_slot_get_type
(
slot
)
==
type
);
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
();
srv_sys_mutex_exit
();
...
@@ -858,8 +859,7 @@ srv_suspend_thread_low(
...
@@ -858,8 +859,7 @@ srv_suspend_thread_low(
ut_a
(
!
slot
->
suspended
);
ut_a
(
!
slot
->
suspended
);
slot
->
suspended
=
TRUE
;
slot
->
suspended
=
TRUE
;
if
(
lint
(
my_atomic_addlint
(
&
srv_sys
.
n_threads_active
[
type
],
ulint
(
-
1
)))
if
(
srv_sys
.
n_threads_active
[
type
]
--
==
0
)
{
<
0
)
{
ut_error
;
ut_error
;
}
}
...
@@ -916,7 +916,7 @@ srv_resume_thread(srv_slot_t* slot, int64_t sig_count = 0, bool wait = true,
...
@@ -916,7 +916,7 @@ srv_resume_thread(srv_slot_t* slot, int64_t sig_count = 0, bool wait = true,
ut_ad
(
slot
->
suspended
);
ut_ad
(
slot
->
suspended
);
slot
->
suspended
=
FALSE
;
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
();
srv_sys_mutex_exit
();
return
(
timeout
);
return
(
timeout
);
}
}
...
@@ -1913,7 +1913,7 @@ srv_active_wake_master_thread_low()
...
@@ -1913,7 +1913,7 @@ srv_active_wake_master_thread_low()
srv_inc_activity_count
();
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_slot_t
*
slot
;
srv_sys_mutex_enter
();
srv_sys_mutex_enter
();
...
@@ -1938,7 +1938,7 @@ srv_wake_purge_thread_if_not_active()
...
@@ -1938,7 +1938,7 @@ srv_wake_purge_thread_if_not_active()
ut_ad
(
!
srv_sys_mutex_own
());
ut_ad
(
!
srv_sys_mutex_own
());
if
(
purge_sys
.
enabled
()
&&
!
purge_sys
.
paused
()
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
)
{
&&
trx_sys
.
rseg_history_len
)
{
srv_release_threads
(
SRV_PURGE
,
1
);
srv_release_threads
(
SRV_PURGE
,
1
);
...
@@ -2481,7 +2481,7 @@ DECLARE_THREAD(srv_worker_thread)(
...
@@ -2481,7 +2481,7 @@ DECLARE_THREAD(srv_worker_thread)(
slot
=
srv_reserve_slot
(
SRV_WORKER
);
slot
=
srv_reserve_slot
(
SRV_WORKER
);
ut_a
(
srv_n_purge_threads
>
1
);
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
);
<
srv_n_purge_threads
);
/* We need to ensure that the worker threads exit after the
/* We need to ensure that the worker threads exit after the
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment