summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2017-09-26 15:35:34 +0300
committerSergey Vojtovich <svoj@mariadb.org>2017-09-27 13:47:56 +0400
commitfd2c5d19d0f0eeb054d18d4455d3ad28dd680219 (patch)
treeb92288f56828593cf595602ea1a76fe36607cb68 /storage
parenta02b81daeaa63c327bea9e6c24fe45b53dc0008e (diff)
downloadmariadb-git-fd2c5d19d0f0eeb054d18d4455d3ad28dd680219.tar.gz
fix a data race
reapply 6192f0bffa798c01acc85db9f427ed02234aead4 TSAN warnings count decreased from 206 to 195
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/sync/sync0debug.cc43
1 files changed, 2 insertions, 41 deletions
diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc
index c80ea6aef3e..fa7a99ea4c0 100644
--- a/storage/innobase/sync/sync0debug.cc
+++ b/storage/innobase/sync/sync0debug.cc
@@ -49,14 +49,7 @@ my_bool srv_sync_debug;
/** The global mutex which protects debug info lists of all rw-locks.
To modify the debug info list of an rw-lock, this mutex has to be
acquired in addition to the mutex protecting the lock. */
-static ib_mutex_t rw_lock_debug_mutex;
-
-/** If deadlock detection does not get immediately the mutex,
-it may wait for this event */
-static os_event_t rw_lock_debug_event;
-
-/** This is set to true, if there may be waiters for the event */
-static bool rw_lock_debug_waiters;
+static SysMutex rw_lock_debug_mutex;
/** The latch held by a thread */
struct Latched {
@@ -1242,13 +1235,7 @@ void
LatchDebug::init()
UNIV_NOTHROW
{
- ut_a(rw_lock_debug_event == NULL);
-
mutex_create(LATCH_ID_RW_LOCK_DEBUG, &rw_lock_debug_mutex);
-
- rw_lock_debug_event = os_event_create("rw_lock_debug_event");
-
- rw_lock_debug_waiters = FALSE;
}
/** Shutdown the latch debug checking
@@ -1259,12 +1246,6 @@ void
LatchDebug::shutdown()
UNIV_NOTHROW
{
- ut_a(rw_lock_debug_event != NULL);
-
- os_event_destroy(rw_lock_debug_event);
-
- rw_lock_debug_event = NULL;
-
mutex_free(&rw_lock_debug_mutex);
ut_a(s_initialized);
@@ -1284,22 +1265,7 @@ mutex. */
void
rw_lock_debug_mutex_enter()
{
- for (;;) {
-
- if (0 == mutex_enter_nowait(&rw_lock_debug_mutex)) {
- return;
- }
-
- os_event_reset(rw_lock_debug_event);
-
- rw_lock_debug_waiters = TRUE;
-
- if (0 == mutex_enter_nowait(&rw_lock_debug_mutex)) {
- return;
- }
-
- os_event_wait(rw_lock_debug_event);
- }
+ mutex_enter(&rw_lock_debug_mutex);
}
/** Releases the debug mutex. */
@@ -1307,11 +1273,6 @@ void
rw_lock_debug_mutex_exit()
{
mutex_exit(&rw_lock_debug_mutex);
-
- if (rw_lock_debug_waiters) {
- rw_lock_debug_waiters = FALSE;
- os_event_set(rw_lock_debug_event);
- }
}
#endif /* UNIV_DEBUG */