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
f3ad3bbe
Commit
f3ad3bbe
authored
Oct 12, 2017
by
Eugene Kosov
Committed by
Sergey Vojtovich
Oct 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix data races
parent
7d2a7782
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
storage/innobase/include/sync0rw.ic
storage/innobase/include/sync0rw.ic
+11
-7
storage/innobase/sync/sync0rw.cc
storage/innobase/sync/sync0rw.cc
+3
-1
No files found.
storage/innobase/include/sync0rw.ic
View file @
f3ad3bbe
...
...
@@ -393,17 +393,21 @@ rw_lock_x_unlock_func(
#endif /* UNIV_DEBUG */
rw_lock_t* lock) /*!< in/out: rw-lock */
{
ut_ad(lock->lock_word == 0 || lock->lock_word == -X_LOCK_HALF_DECR
|| lock->lock_word <= -X_LOCK_DECR);
lint lock_word;
lock_word = my_atomic_loadlint_explicit(&lock->lock_word,
MY_MEMORY_ORDER_RELAXED);
if (lock->lock_word == 0) {
ut_ad(lock_word == 0 || lock_word == -X_LOCK_HALF_DECR
|| lock_word <= -X_LOCK_DECR);
if (lock_word == 0) {
/* Last caller in a possible recursive chain. */
lock->writer_thread = 0;
}
ut_d(rw_lock_remove_debug_info(lock, pass, RW_LOCK_X));
if (lock
->lock_word == 0 || lock->
lock_word == -X_LOCK_HALF_DECR) {
if (lock
_word == 0 ||
lock_word == -X_LOCK_HALF_DECR) {
/* There is 1 x-lock */
/* atomic increment is needed, because it is last */
if (my_atomic_addlint(&lock->lock_word, X_LOCK_DECR) <= -X_LOCK_DECR) {
...
...
@@ -421,13 +425,13 @@ rw_lock_x_unlock_func(
os_event_set(lock->event);
sync_array_object_signalled();
}
} else if (lock
->lock
_word == -X_LOCK_DECR
|| lock
->lock
_word == -(X_LOCK_DECR + X_LOCK_HALF_DECR)) {
} else if (lock_word == -X_LOCK_DECR
|| lock_word == -(X_LOCK_DECR + X_LOCK_HALF_DECR)) {
/* There are 2 x-locks */
lock->lock_word += X_LOCK_DECR;
} else {
/* There are more than 2 x-locks. */
ut_ad(lock
->lock
_word < -X_LOCK_DECR);
ut_ad(lock_word < -X_LOCK_DECR);
lock->lock_word += 1;
}
...
...
storage/innobase/sync/sync0rw.cc
View file @
f3ad3bbe
...
...
@@ -310,7 +310,9 @@ rw_lock_s_lock_spin(
/* Spin waiting for the writer field to become free */
HMT_low
();
while
(
i
<
srv_n_spin_wait_rounds
&&
lock
->
lock_word
<=
0
)
{
while
(
i
<
srv_n_spin_wait_rounds
&&
my_atomic_loadlint_explicit
(
&
lock
->
lock_word
,
MY_MEMORY_ORDER_RELAXED
)
<=
0
)
{
if
(
srv_spin_wait_delay
)
{
ut_delay
(
ut_rnd_interval
(
0
,
srv_spin_wait_delay
));
}
...
...
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