summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-10-01 18:14:19 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-10-01 18:14:19 +0300
commit4a7cf85ae8d11d8542c7e771f6a60f98d997600e (patch)
tree7b181754ac3ad44db0c0a65a6272c726ca22aec9
parentd0539bbcc17535e8793d196c40442dba4f8cca29 (diff)
downloadmariadb-git-bb-10.5-MDEV-23399.tar.gz
MDEV-21452: Clean up LatchDebug, remove OSMutex, latch_t, ...bb-10.5-MDEV-23399
-rw-r--r--storage/innobase/CMakeLists.txt1
-rw-r--r--storage/innobase/handler/ha_innodb.cc5
-rw-r--r--storage/innobase/include/srv0mon.h1
-rw-r--r--storage/innobase/include/sync0debug.h13
-rw-r--r--storage/innobase/include/sync0policy.h296
-rw-r--r--storage/innobase/include/sync0rw.h25
-rw-r--r--storage/innobase/include/sync0sync.h7
-rw-r--r--storage/innobase/include/sync0types.h355
-rw-r--r--storage/innobase/sync/sync0debug.cc130
-rw-r--r--storage/innobase/sync/sync0rw.cc2
-rw-r--r--storage/innobase/sync/sync0sync.cc22
11 files changed, 96 insertions, 761 deletions
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index 62284869120..a712ab26de1 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -238,7 +238,6 @@ SET(INNOBASE_SOURCES
include/sync0arr.h
include/sync0arr.ic
include/sync0debug.h
- include/sync0policy.h
include/sync0rw.h
include/sync0rw.ic
include/sync0sync.h
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 8881c5c0627..9ebf869f1a8 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -522,7 +522,6 @@ static PSI_mutex_info all_innodb_mutexes[] = {
PSI_KEY(ibuf_mutex),
PSI_KEY(ibuf_pessimistic_insert_mutex),
PSI_KEY(log_sys_mutex),
- PSI_KEY(mutex_list_mutex),
PSI_KEY(page_zip_stat_per_index_mutex),
PSI_KEY(purge_sys_pq_mutex),
PSI_KEY(recv_sys_mutex),
@@ -532,7 +531,6 @@ static PSI_mutex_info all_innodb_mutexes[] = {
PSI_KEY(rw_lock_debug_mutex),
# endif /* UNIV_DEBUG */
PSI_KEY(rw_lock_list_mutex),
- PSI_KEY(rw_lock_mutex),
PSI_KEY(srv_innodb_monitor_mutex),
PSI_KEY(srv_misc_tmpfile_mutex),
PSI_KEY(srv_monitor_file_mutex),
@@ -543,9 +541,6 @@ static PSI_mutex_info all_innodb_mutexes[] = {
PSI_KEY(lock_wait_mutex),
PSI_KEY(trx_mutex),
PSI_KEY(srv_threads_mutex),
-# ifndef PFS_SKIP_EVENT_MUTEX
- PSI_KEY(event_mutex),
-# endif /* PFS_SKIP_EVENT_MUTEX */
PSI_KEY(rtr_active_mutex),
PSI_KEY(rtr_match_mutex),
PSI_KEY(rtr_path_mutex),
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index 5e99a2fd7a0..a160c69bb72 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -38,7 +38,6 @@ Created 12/15/2009 Jimmy Yang
#include <stdint.h>
#include "my_atomic.h"
-#include "my_atomic_wrapper.h"
/** Possible status values for "mon_status" in "struct monitor_value" */
enum monitor_running_status {
diff --git a/storage/innobase/include/sync0debug.h b/storage/innobase/include/sync0debug.h
index 07e985465e0..af081bf955f 100644
--- a/storage/innobase/include/sync0debug.h
+++ b/storage/innobase/include/sync0debug.h
@@ -47,35 +47,34 @@ sync_check_close();
/** Check if it is OK to acquire the latch.
@param[in] latch latch type */
void
-sync_check_lock_validate(const latch_t* latch);
+sync_check_lock_validate(const rw_lock_t* latch);
/** Note that the lock has been granted
@param[in] latch latch type */
void
-sync_check_lock_granted(const latch_t* latch);
+sync_check_lock_granted(const rw_lock_t* latch);
/** Check if it is OK to acquire the latch.
@param[in] latch latch type
@param[in] level the level of the mutex */
void
-sync_check_lock(const latch_t* latch, latch_level_t level);
+sync_check_lock(const rw_lock_t* latch, latch_level_t level);
/**
Check if it is OK to re-acquire the lock. */
void
-sync_check_relock(const latch_t* latch);
+sync_check_relock(const rw_lock_t* latch);
/** Removes a latch from the thread level array if it is found there.
@param[in] latch to unlock */
void
-sync_check_unlock(const latch_t* latch);
+sync_check_unlock(const rw_lock_t* latch);
/** Checks if the level array for the current thread contains a
mutex or rw-latch at the specified level.
@param[in] level to find
@return a matching latch, or NULL if not found */
-const latch_t*
-sync_check_find(latch_level_t level);
+const rw_lock_t* sync_check_find(latch_level_t level);
/** Checks that the level array for the current thread is empty.
Terminate iteration if the functor returns true.
diff --git a/storage/innobase/include/sync0policy.h b/storage/innobase/include/sync0policy.h
deleted file mode 100644
index 68397827891..00000000000
--- a/storage/innobase/include/sync0policy.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
-
-*****************************************************************************/
-
-/******************************************************************//**
-@file include/sync0policy.h
-Policies for mutexes.
-
-Created 2012-08-21 Sunny Bains.
-***********************************************************************/
-
-#ifndef sync0policy_h
-#define sync0policy_h
-
-#include "ut0rnd.h"
-#include "os0thread.h"
-#include "srv0mon.h"
-#include "sync0debug.h"
-
-#ifdef UNIV_DEBUG
-
-template <typename Mutex> class MutexDebug: public latch_t
-{
- /** Mutex to check for lock order violation */
- const Mutex *m_mutex;
- /** Filename from where enter was called */
- const char *m_filename;
- /** Line mumber in filename */
- unsigned m_line;
- /** Thread ID of the thread that owns the mutex */
- os_thread_id_t m_thread_id;
- /** Mutex protecting the above members */
- mutable OSMutex m_debug_mutex;
-
-
- void set(const Mutex *mutex, const char *filename, unsigned line,
- os_thread_id_t thread_id)
- {
- m_debug_mutex.enter();
- m_mutex= mutex;
- m_filename= filename;
- m_line= line;
- m_thread_id= thread_id;
- m_debug_mutex.exit();
- }
-
-
- const MutexDebug get() const
- {
- MutexDebug ret;
- m_debug_mutex.enter();
- ret.m_mutex= m_mutex;
- ret.m_filename= m_filename;
- ret.m_line= m_line;
- ret.m_thread_id= m_thread_id;
- m_debug_mutex.exit();
- return ret;
- }
-
-
- /**
- Called either when mutex is locked or destroyed. Thus members are protected
- from concurrent modification.
- */
- void assert_clean_context()
- {
- ut_ad(!m_mutex);
- ut_ad(!m_filename);
- ut_ad(!m_line);
- ut_ad(m_thread_id == os_thread_id_t(ULINT_UNDEFINED));
- }
-
-
-public:
- /**
- Called when the mutex is "created". Note: Not from the constructor
- but when the mutex is initialised.
- @param[in] id Mutex ID
- */
- void init(latch_id_t id)
- {
- ut_ad(id != LATCH_ID_NONE);
- m_id= id;
- m_debug_mutex.init();
- set(0, 0, 0, os_thread_id_t(ULINT_UNDEFINED));
- }
-
-
- /** Mutex is being destroyed. */
- void destroy()
- {
- assert_clean_context();
- m_debug_mutex.destroy();
- }
-
-
- /**
- Called when an attempt is made to lock the mutex
- @param[in] mutex Mutex instance to be locked
- @param[in] filename Filename from where it was called
- @param[in] line Line number from where it was called
- */
- void enter(const Mutex &mutex, const char *filename, unsigned line)
- {
- MutexDebug context;
- ut_ad(!is_owned());
- context.init(m_id);
- context.set(&mutex, filename, line, os_thread_get_curr_id());
- /* Check for latch order violation. */
- sync_check_lock_validate(&context);
- context.set(0, 0, 0, os_thread_id_t(ULINT_UNDEFINED));
- context.destroy();
- }
-
-
- /**
- Called when the mutex is locked
- @param[in] mutex Mutex instance that was locked
- @param[in] filename Filename from where it was called
- @param[in] line Line number from where it was called
- */
- void locked(const Mutex &mutex, const char *filename, unsigned line)
- {
- assert_clean_context();
- set(&mutex, filename, line, os_thread_get_curr_id());
- sync_check_lock_granted(this);
- }
-
-
- /**
- Called when the mutex is released
- @param[in] mutex Mutex that was released
- */
- void release(const Mutex &mutex)
- {
- ut_ad(is_owned());
- set(0, 0, 0, os_thread_id_t(ULINT_UNDEFINED));
- sync_check_unlock(this);
- }
-
-
- /** @return true if thread owns the mutex */
- bool is_owned() const
- {
- return os_thread_eq(get_thread_id(), os_thread_get_curr_id());
- }
-
-
- /** @return the name of the file from the mutex was acquired */
- const char* get_enter_filename() const { return get().m_filename; }
-
-
- /** @return the name of the file from the mutex was acquired */
- unsigned get_enter_line() const { return get().m_line; }
-
-
- /** @return id of the thread that was trying to acquire the mutex */
- os_thread_id_t get_thread_id() const { return get().m_thread_id; }
-
-
- /**
- Print information about the latch
- @return the string representation
- */
- virtual std::string to_string() const
- {
- std::ostringstream msg;
- const MutexDebug ctx= get();
-
- msg << m_mutex->policy().to_string();
- if (ctx.m_mutex)
- msg << " addr: " << ctx.m_mutex << " acquired: "
- << sync_basename(ctx.get_enter_filename()) << ":"
- << ctx.get_enter_line();
- else
- msg << "Not locked";
-
- return(msg.str());
- }
-};
-#endif /* UNIV_DEBUG */
-
-/** Collect the metrics per mutex instance, no aggregation. */
-template <typename Mutex>
-struct GenericPolicy
-{
-public:
- /** Called when the mutex is "created". Note: Not from the constructor
- but when the mutex is initialised.
- @param[in] id Mutex ID
- @param[in] filename File where mutex was created
- @param[in] line Line in filename */
- void init(
- const Mutex&,
- latch_id_t id,
- const char* filename,
- uint32_t line)
- UNIV_NOTHROW
- {
- m_id = id;
-
- latch_meta_t& meta = sync_latch_get_meta(id);
-
- ut_ad(meta.get_id() == id);
-
- meta.get_counter()->single_register(&m_count);
-
- m_filename = filename;
- m_line = line;
- }
-
- /** Called when the mutex is destroyed. */
- void destroy()
- UNIV_NOTHROW
- {
- latch_meta_t& meta = sync_latch_get_meta(m_id);
-
- meta.get_counter()->single_deregister(&m_count);
- }
-
- /** Called after a successful mutex acquire.
- @param[in] n_spins Number of times the thread did
- spins while trying to acquire the mutex
- @param[in] n_waits Number of times the thread waited
- in some type of OS queue */
- void add(
- uint32_t n_spins,
- uint32_t n_waits)
- UNIV_NOTHROW
- {
- /* Currently global on/off. Keeps things simple and fast */
-
- if (!m_count.m_enabled) {
-
- return;
- }
-
- m_count.m_spins += n_spins;
- m_count.m_waits += n_waits;
-
- ++m_count.m_calls;
- }
-
- /** Print the information about the latch
- @return the string representation */
- std::string print() const
- UNIV_NOTHROW;
-
- /** @return the latch ID */
- latch_id_t get_id() const
- UNIV_NOTHROW
- {
- return(m_id);
- }
-
-
- /** @return the string representation */
- std::string to_string() const
- {
- return sync_mutex_to_string(get_id(),
- std::string(m_filename)
- .append(":")
- .append(std::to_string(m_line)));
- }
-
-#ifdef UNIV_DEBUG
- MutexDebug<Mutex> context;
-#endif
-
-private:
- const char *m_filename;
- uint32_t m_line;
-
- /** The user visible counters, registered with the meta-data. */
- latch_meta_t::CounterType::Count m_count;
-
- /** Latch meta data ID */
- latch_id_t m_id;
-};
-
-#endif /* sync0policy_h */
diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h
index b6dcd863b5e..c1111f840e2 100644
--- a/storage/innobase/include/sync0rw.h
+++ b/storage/innobase/include/sync0rw.h
@@ -97,11 +97,6 @@ of concurrent read locks before the rw_lock breaks. */
#define X_LOCK_DECR 0x20000000
#define X_LOCK_HALF_DECR 0x10000000
-#ifdef rw_lock_t
-#undef rw_lock_t
-#endif
-struct rw_lock_t;
-
#ifdef UNIV_DEBUG
struct rw_lock_debug_t;
#endif /* UNIV_DEBUG */
@@ -562,11 +557,23 @@ new readers will be let in while the thread waits for readers to
exit. */
struct rw_lock_t :
-#ifdef UNIV_DEBUG
- public latch_t,
-#endif /* UNIV_DEBUG */
public ilist_node<>
{
+ /** @return the latch ID */
+ latch_id_t get_id() const { return m_id; }
+
+ /** Print the latch context
+ @return the string representation */
+ std::string to_string();
+
+ /** @return the latch level */
+ latch_level_t get_level() const { return sync_latch_get_level(m_id); }
+
+ /** @return the latch name, m_id must be set */
+ const char* get_name() const { return sync_latch_get_name(m_id); }
+ /** Latch ID */
+ latch_id_t m_id= LATCH_ID_NONE;
+
ut_d(bool created= false;)
/** Holds the state of the lock. */
@@ -619,7 +626,7 @@ struct rw_lock_t :
#endif /* UNIV_PFS_RWLOCK */
#ifdef UNIV_DEBUG
- std::string to_string() const override;
+ std::string to_string() const;
/** In the debug version: pointer to the debug info list of the lock */
UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list;
diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
index cd54f98dad9..8acef69816c 100644
--- a/storage/innobase/include/sync0sync.h
+++ b/storage/innobase/include/sync0sync.h
@@ -43,9 +43,6 @@ Created 9/5/1995 Heikki Tuuri
instrumentation due to their large number of instances. */
# define PFS_SKIP_BUFFER_MUTEX_RWLOCK
-/* By default, event->mutex will also be excluded from instrumentation */
-# define PFS_SKIP_EVENT_MUTEX
-
#endif /* UNIV_PFS_MUTEX || UNIV_PFS_RWLOCK */
#ifdef UNIV_PFS_MUTEX
@@ -64,7 +61,6 @@ extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key;
extern mysql_pfs_key_t log_sys_mutex_key;
extern mysql_pfs_key_t log_cmdq_mutex_key;
extern mysql_pfs_key_t log_flush_order_mutex_key;
-extern mysql_pfs_key_t mutex_list_mutex_key;
extern mysql_pfs_key_t recalc_pool_mutex_key;
extern mysql_pfs_key_t purge_sys_pq_mutex_key;
extern mysql_pfs_key_t recv_sys_mutex_key;
@@ -76,7 +72,6 @@ extern mysql_pfs_key_t page_zip_stat_per_index_mutex_key;
extern mysql_pfs_key_t rw_lock_debug_mutex_key;
# endif /* UNIV_DEBUG */
extern mysql_pfs_key_t rw_lock_list_mutex_key;
-extern mysql_pfs_key_t rw_lock_mutex_key;
extern mysql_pfs_key_t srv_innodb_monitor_mutex_key;
extern mysql_pfs_key_t srv_misc_tmpfile_mutex_key;
extern mysql_pfs_key_t srv_monitor_file_mutex_key;
@@ -87,8 +82,6 @@ extern mysql_pfs_key_t trx_pool_manager_mutex_key;
extern mysql_pfs_key_t lock_mutex_key;
extern mysql_pfs_key_t lock_wait_mutex_key;
extern mysql_pfs_key_t srv_threads_mutex_key;
-extern mysql_pfs_key_t event_mutex_key;
-extern mysql_pfs_key_t event_manager_mutex_key;
extern mysql_pfs_key_t sync_array_mutex_key;
extern mysql_pfs_key_t thread_mutex_key;
extern mysql_pfs_key_t row_drop_list_mutex_key;
diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h
index 712153569ef..cd446a76316 100644
--- a/storage/innobase/include/sync0types.h
+++ b/storage/innobase/include/sync0types.h
@@ -24,32 +24,13 @@ Global types for sync
Created 9/5/1995 Heikki Tuuri
*******************************************************/
-#ifndef sync0types_h
-#define sync0types_h
-
+#pragma once
+#include "my_atomic_wrapper.h"
#include <vector>
#include "ut0new.h"
-
-#ifdef _WIN32
-/** Native mutex */
-typedef CRITICAL_SECTION sys_mutex_t;
-#else
-/** Native mutex */
-typedef pthread_mutex_t sys_mutex_t;
-#endif /* _WIN32 */
-
-/** Mutex states. */
-enum mutex_state_t {
- /** Mutex is free */
- MUTEX_STATE_UNLOCKED = 0,
-
- /** Mutex is acquired by some thread. */
- MUTEX_STATE_LOCKED = 1,
-
- /** Mutex is contended and there are threads waiting on the lock. */
- MUTEX_STATE_WAITERS = 2
-};
+#undef rw_lock_t
+struct rw_lock_t;
/*
LATCHING ORDER WITHIN THE DATABASE
@@ -184,8 +165,6 @@ enum latch_level_t {
RW_LOCK_X,
RW_LOCK_NOT_LOCKED,
- SYNC_MONITOR_MUTEX,
-
SYNC_ANY_LATCH,
SYNC_BUF_PAGE_HASH,
@@ -236,151 +215,20 @@ enum latch_level_t {
up its meta-data. See sync0debug.c. */
enum latch_id_t {
LATCH_ID_NONE = 0,
- LATCH_ID_FILE_FORMAT_MAX,
- LATCH_ID_LIST,
- LATCH_ID_MUTEX_LIST,
- LATCH_ID_RW_LOCK_MUTEX,
- LATCH_ID_SRV_SYS,
- LATCH_ID_EVENT_MANAGER,
- LATCH_ID_EVENT_MUTEX,
LATCH_ID_BTR_SEARCH,
LATCH_ID_BUF_BLOCK_LOCK,
LATCH_ID_BUF_BLOCK_DEBUG,
LATCH_ID_DICT_OPERATION,
- LATCH_ID_CHECKPOINT,
LATCH_ID_FIL_SPACE,
LATCH_ID_TRX_I_S_CACHE,
LATCH_ID_TRX_PURGE,
LATCH_ID_IBUF_INDEX_TREE,
LATCH_ID_INDEX_TREE,
LATCH_ID_DICT_TABLE_STATS,
- LATCH_ID_HASH_TABLE_RW_LOCK,
- LATCH_ID_BUF_CHUNK_MAP_LATCH,
- LATCH_ID_SYNC_DEBUG_MUTEX,
- LATCH_ID_TEST_MUTEX,
- LATCH_ID_MAX = LATCH_ID_TEST_MUTEX
-};
-
-#ifndef UNIV_INNOCHECKSUM
-/** OS mutex, without any policy. It is a thin wrapper around the
-system mutexes. The interface is different from the policy mutexes,
-to ensure that it is called directly and not confused with the
-policy mutexes. */
-struct OSMutex {
-
- /** Constructor */
- OSMutex()
- UNIV_NOTHROW
- {
- ut_d(m_freed = true);
- }
-
- /** Create the mutex by calling the system functions. */
- void init()
- UNIV_NOTHROW
- {
- ut_ad(m_freed);
-
-#ifdef _WIN32
- InitializeCriticalSection((LPCRITICAL_SECTION) &m_mutex);
-#else
- {
- int ret = pthread_mutex_init(&m_mutex, NULL);
- ut_a(ret == 0);
- }
-#endif /* _WIN32 */
-
- ut_d(m_freed = false);
- }
-
- /** Destructor */
- ~OSMutex() { }
-
- /** Destroy the mutex */
- void destroy()
- UNIV_NOTHROW
- {
- ut_ad(!m_freed);
-#ifdef _WIN32
- DeleteCriticalSection((LPCRITICAL_SECTION) &m_mutex);
-#else
- int ret;
-
- ret = pthread_mutex_destroy(&m_mutex);
-
- if (ret != 0) {
-
- ib::error()
- << "Return value " << ret << " when calling "
- << "pthread_mutex_destroy().";
- }
-#endif /* _WIN32 */
- ut_d(m_freed = true);
- }
-
- /** Release the mutex. */
- void exit()
- UNIV_NOTHROW
- {
- ut_ad(!m_freed);
-#ifdef _WIN32
- LeaveCriticalSection(&m_mutex);
-#else
- int ret = pthread_mutex_unlock(&m_mutex);
- ut_a(ret == 0);
-#endif /* _WIN32 */
- }
-
- /** Acquire the mutex. */
- void enter()
- UNIV_NOTHROW
- {
- ut_ad(!m_freed);
-#ifdef _WIN32
- EnterCriticalSection((LPCRITICAL_SECTION) &m_mutex);
-#else
- int ret = pthread_mutex_lock(&m_mutex);
- ut_a(ret == 0);
-#endif /* _WIN32 */
- }
-
- /** @return true if locking succeeded */
- bool try_lock()
- UNIV_NOTHROW
- {
- ut_ad(!m_freed);
-#ifdef _WIN32
- return(TryEnterCriticalSection(&m_mutex) != 0);
-#else
- return(pthread_mutex_trylock(&m_mutex) == 0);
-#endif /* _WIN32 */
- }
-
- /** Required for os_event_t */
- operator sys_mutex_t*()
- UNIV_NOTHROW
- {
- return(&m_mutex);
- }
-
-private:
-#ifdef DBUG_ASSERT_EXISTS
- /** true if the mutex has been freed/destroyed. */
- bool m_freed;
-#endif /* DBUG_ASSERT_EXISTS */
-
- sys_mutex_t m_mutex;
+ LATCH_ID_MAX = LATCH_ID_DICT_TABLE_STATS
};
#ifdef UNIV_PFS_MUTEX
-/** Latch element.
-Used for mutexes which have PFS keys defined under UNIV_PFS_MUTEX.
-@param[in] id Latch id
-@param[in] level Latch level
-@param[in] key PFS key */
-# define LATCH_ADD_MUTEX(id, level, key) latch_meta[LATCH_ID_ ## id] =\
- UT_NEW_NOKEY(latch_meta_t(LATCH_ID_ ## id, #id, level, #level, key))
-
#ifdef UNIV_PFS_RWLOCK
/** Latch element.
Used for rwlocks which have PFS keys defined under UNIV_PFS_RWLOCK.
@@ -396,8 +244,6 @@ Used for rwlocks which have PFS keys defined under UNIV_PFS_RWLOCK.
#endif /* UNIV_PFS_RWLOCK */
#else
-# define LATCH_ADD_MUTEX(id, level, key) latch_meta[LATCH_ID_ ## id] =\
- UT_NEW_NOKEY(latch_meta_t(LATCH_ID_ ## id, #id, level, #level))
# define LATCH_ADD_RWLOCK(id, level, key) latch_meta[LATCH_ID_ ## id] =\
UT_NEW_NOKEY(latch_meta_t(LATCH_ID_ ## id, #id, level, #level))
#endif /* UNIV_PFS_MUTEX */
@@ -444,28 +290,14 @@ public:
};
/** Constructor */
- LatchCounter()
- UNIV_NOTHROW
- :
- m_active(false)
- {
- m_mutex.init();
- }
+ LatchCounter() { mysql_mutex_init(0, &m_mutex, nullptr); }
/** Destructor */
~LatchCounter()
UNIV_NOTHROW
{
- m_mutex.destroy();
-
- for (Counters::iterator it = m_counters.begin();
- it != m_counters.end();
- ++it) {
-
- Count* count = *it;
-
- UT_DELETE(count);
- }
+ mysql_mutex_destroy(&m_mutex);
+ for (Count *count : m_counters) UT_DELETE(count);
}
/** Reset all counters to zero. It is not protected by any
@@ -475,25 +307,16 @@ public:
void reset()
UNIV_NOTHROW
{
- m_mutex.enter();
-
- Counters::iterator end = m_counters.end();
-
- for (Counters::iterator it = m_counters.begin();
- it != end;
- ++it) {
-
- (*it)->reset();
- }
-
- m_mutex.exit();
+ mysql_mutex_lock(&m_mutex);
+ for (Count *count : m_counters) count->reset();
+ mysql_mutex_unlock(&m_mutex);
}
/** @return the aggregate counter */
Count* sum_register()
UNIV_NOTHROW
{
- m_mutex.enter();
+ mysql_mutex_lock(&m_mutex);
Count* count;
@@ -505,7 +328,7 @@ public:
count = m_counters[0];
}
- m_mutex.exit();
+ mysql_mutex_unlock(&m_mutex);
return(count);
}
@@ -514,11 +337,9 @@ public:
void single_register(Count* count)
UNIV_NOTHROW
{
- m_mutex.enter();
-
+ mysql_mutex_lock(&m_mutex);
m_counters.push_back(count);
-
- m_mutex.exit();
+ mysql_mutex_unlock(&m_mutex);
}
/** Deregister a single instance counter
@@ -526,15 +347,13 @@ public:
void single_deregister(Count* count)
UNIV_NOTHROW
{
- m_mutex.enter();
-
+ mysql_mutex_lock(&m_mutex);
m_counters.erase(
std::remove(
m_counters.begin(),
m_counters.end(), count),
m_counters.end());
-
- m_mutex.exit();
+ mysql_mutex_unlock(&m_mutex);
}
/** Iterate over the counters */
@@ -542,80 +361,43 @@ public:
void iterate(Callback& callback) const
UNIV_NOTHROW
{
- Counters::const_iterator end = m_counters.end();
-
- for (Counters::const_iterator it = m_counters.begin();
- it != end;
- ++it) {
-
- callback(*it);
- }
+ for (Count *count : m_counters) callback(count);
}
/** Disable the monitoring */
void enable()
UNIV_NOTHROW
{
- m_mutex.enter();
-
- Counters::const_iterator end = m_counters.end();
-
- for (Counters::const_iterator it = m_counters.begin();
- it != end;
- ++it) {
-
- (*it)->m_enabled = true;
- }
-
+ mysql_mutex_lock(&m_mutex);
+ for (Count *count : m_counters) count->m_enabled = true;
m_active = true;
-
- m_mutex.exit();
+ mysql_mutex_unlock(&m_mutex);
}
/** Disable the monitoring */
void disable()
UNIV_NOTHROW
{
- m_mutex.enter();
-
- Counters::const_iterator end = m_counters.end();
-
- for (Counters::const_iterator it = m_counters.begin();
- it != end;
- ++it) {
-
- (*it)->m_enabled = false;
- }
-
+ mysql_mutex_lock(&m_mutex);
+ for (Count *count : m_counters) count->m_enabled = false;
m_active = false;
-
- m_mutex.exit();
+ mysql_mutex_unlock(&m_mutex);
}
/** @return if monitoring is active */
- bool is_enabled() const
- UNIV_NOTHROW
- {
- return(m_active);
- }
+ bool is_enabled() const { return m_active; }
-private:
- /* Disable copying */
- LatchCounter(const LatchCounter&);
- LatchCounter& operator=(const LatchCounter&);
-
-private:
- typedef OSMutex Mutex;
- typedef std::vector<Count*> Counters;
+ LatchCounter(const LatchCounter&) = delete;
+ LatchCounter& operator=(const LatchCounter&) = delete;
/** Mutex protecting m_counters */
- Mutex m_mutex;
+ mysql_mutex_t m_mutex;
/** Counters for the latches */
- Counters m_counters;
+ std::vector<Count*> m_counters;
/** if true then we collect the data */
- bool m_active;
+ Atomic_relaxed<bool> m_active= false;
};
/** Latch meta data */
@@ -780,6 +562,8 @@ inline
const char*
sync_latch_get_name(latch_id_t id)
{
+ ut_ad(id != LATCH_ID_NONE);
+
const latch_meta_t& meta = sync_latch_get_meta(id);
return(meta.get_name());
@@ -792,6 +576,8 @@ inline
latch_level_t
sync_latch_get_level(latch_id_t id)
{
+ ut_ad(id != LATCH_ID_NONE);
+
const latch_meta_t& meta = sync_latch_get_meta(id);
return(meta.get_level());
@@ -811,16 +597,6 @@ sync_latch_get_pfs_key(latch_id_t id)
}
#endif
-/** String representation of the filename and line number where the
-latch was created
-@param[in] id Latch ID
-@param[in] created Filename and line number where it was crated
-@return the string representation */
-std::string
-sync_mutex_to_string(
- latch_id_t id,
- const std::string& created);
-
/** Get the latch name from a sync level
@param[in] level Latch level to lookup
@return 0 if not found. */
@@ -833,64 +609,6 @@ const char*
sync_basename(const char* filename);
#ifdef UNIV_DEBUG
-
-/** All (ordered) latches, used in debugging, must derive from this class. */
-struct latch_t {
-
- /** Constructor
- @param[in] id The latch ID */
- explicit latch_t(latch_id_t id = LATCH_ID_NONE)
- UNIV_NOTHROW
- :
- m_id(id),
- m_rw_lock() {}
-
- /** Destructor */
- virtual ~latch_t() UNIV_NOTHROW { }
-
- /** @return the latch ID */
- latch_id_t get_id() const
- {
- return(m_id);
- }
-
- /** @return true if it is a rw-lock */
- bool is_rw_lock() const
- UNIV_NOTHROW
- {
- return(m_rw_lock);
- }
-
- /** Print the latch context
- @return the string representation */
- virtual std::string to_string() const = 0;
-
- /** @return the latch level */
- latch_level_t get_level() const
- UNIV_NOTHROW
- {
- ut_a(m_id != LATCH_ID_NONE);
-
- return(sync_latch_get_level(m_id));
- }
-
- /** @return the latch name, m_id must be set */
- const char* get_name() const
- UNIV_NOTHROW
- {
- ut_a(m_id != LATCH_ID_NONE);
-
- return(sync_latch_get_name(m_id));
- }
-
- /** Latch ID */
- latch_id_t m_id;
-
- /** true if it is a rw-lock. In debug mode, rw_lock_t derives from
- this class and sets this variable. */
- bool m_rw_lock;
-};
-
/** Subclass this to iterate over a thread's acquired latch levels. */
struct sync_check_functor_t {
virtual ~sync_check_functor_t() { }
@@ -938,7 +656,7 @@ struct sync_allowed_latches : public sync_check_functor_t {
const latch_level_t* to)
: begin(from), end(to) { }
- /** Checks whether the given latch_t violates the latch constraint.
+ /** Checks whether the given rw_lock_t violates the latch constraint.
This object maintains a list of allowed latch levels, and if the given
latch belongs to a latch level that is not there in the allowed list,
then it is a violation.
@@ -974,8 +692,6 @@ enum rw_lock_flag_t {
#endif /* UNIV_DBEUG */
-#endif /* UNIV_INNOCHECKSUM */
-
/** Simple non-atomic counter aligned to CACHE_LINE_SIZE
@tparam Type the integer type of the counter */
template <typename Type>
@@ -998,4 +714,3 @@ private:
/** The counter */
Type m_counter;
};
-#endif /* sync0types_h */
diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc
index ed49ceac263..3871c88135f 100644
--- a/storage/innobase/sync/sync0debug.cc
+++ b/storage/innobase/sync/sync0debug.cc
@@ -59,7 +59,7 @@ struct Latched {
/** Constructor
@param[in] latch Latch instance
@param[in] level Level of latch held */
- Latched(const latch_t* latch,
+ Latched(const rw_lock_t* latch,
latch_level_t level)
:
m_latch(latch),
@@ -83,7 +83,7 @@ struct Latched {
}
/** The latch instance */
- const latch_t* m_latch;
+ const rw_lock_t* m_latch;
/** The latch level. For buffer blocks we can pass a separate latch
level to check against, see buf_block_dbg_add_level() */
@@ -95,11 +95,6 @@ typedef std::vector<Latched, ut_allocator<Latched> > Latches;
/** The deadlock detector. */
struct LatchDebug {
-
- /** Debug mutex for control structures, should not be tracked
- by this module. */
- typedef OSMutex Mutex;
-
/** Comparator for the ThreadMap. */
struct os_thread_id_less
: public std::binary_function<
@@ -130,11 +125,7 @@ struct LatchDebug {
UNIV_NOTHROW;
/** Destructor */
- ~LatchDebug()
- UNIV_NOTHROW
- {
- m_mutex.destroy();
- }
+ ~LatchDebug() { mysql_mutex_destroy(&m_mutex); }
/** Create a new instance if one doesn't exist else return
the existing one.
@@ -158,7 +149,7 @@ struct LatchDebug {
@param[in] latches the thread's existing (acquired) latches
@param[in] level to lookup
@return latch if found or 0 */
- const latch_t* find(
+ const rw_lock_t* find(
const Latches* Latches,
latch_level_t level) const
UNIV_NOTHROW;
@@ -167,7 +158,7 @@ struct LatchDebug {
Checks if the level value exists in the thread's acquired latches.
@param[in] level to lookup
@return latch if found or 0 */
- const latch_t* find(latch_level_t level)
+ const rw_lock_t* find(latch_level_t level)
UNIV_NOTHROW;
/** Report error and abort.
@@ -204,7 +195,7 @@ struct LatchDebug {
@param[in] latch latch that the thread wants to acqire.
@param[in] level latch level to check against */
void lock_validate(
- const latch_t* latch,
+ const rw_lock_t* latch,
latch_level_t level)
UNIV_NOTHROW
{
@@ -236,7 +227,7 @@ struct LatchDebug {
@param[in] latch latch that the thread wants to acqire.
@param[in] level latch level to check against */
void lock_granted(
- const latch_t* latch,
+ const rw_lock_t* latch,
latch_level_t level)
UNIV_NOTHROW
{
@@ -253,11 +244,9 @@ struct LatchDebug {
/** For recursive X rw-locks.
@param[in] latch The RW-Lock to relock */
- void relock(const latch_t* latch)
+ void relock(const rw_lock_t* latch)
UNIV_NOTHROW
{
- ut_a(latch->m_rw_lock);
-
latch_level_t level = latch->get_level();
/* Ignore diagnostic latches, starting with '.' */
@@ -314,7 +303,7 @@ struct LatchDebug {
@return true if found in the array; it is not an error if the latch is
not found, as we presently are not able to determine the level for
every latch reservation the program does */
- void unlock(const latch_t* latch) UNIV_NOTHROW;
+ void unlock(const rw_lock_t* latch) UNIV_NOTHROW;
/** Get the level name
@param[in] level The level ID to lookup
@@ -352,11 +341,10 @@ struct LatchDebug {
s_instance = UT_NEW_NOKEY(LatchDebug());
}
-private:
- /** Disable copying */
- LatchDebug(const LatchDebug&);
- LatchDebug& operator=(const LatchDebug&);
+ LatchDebug(const LatchDebug&) = delete;
+ LatchDebug& operator=(const LatchDebug&) = delete;
+private:
/** Adds a latch and its level in the thread level array. Allocates
the memory for the array if called first time for this OS thread.
Makes the checks against other latch levels stored in the array
@@ -366,7 +354,7 @@ private:
@param[in] level level in the latching order
@return the thread's latches */
Latches* check_order(
- const latch_t* latch,
+ const rw_lock_t* latch,
latch_level_t level)
UNIV_NOTHROW;
@@ -375,7 +363,6 @@ private:
void print_latches(const Latches* latches) const
UNIV_NOTHROW;
-private:
/** Comparator for the Levels . */
struct latch_level_less
: public std::binary_function<
@@ -401,7 +388,7 @@ private:
Levels;
/** Mutex protecting the deadlock detector data structures. */
- Mutex m_mutex;
+ mysql_mutex_t m_mutex;
/** Thread specific data. Protected by m_mutex. */
ThreadMap m_threads;
@@ -431,7 +418,7 @@ do { \
/** Setup the mapping from level ID to level name mapping */
LatchDebug::LatchDebug()
{
- m_mutex.init();
+ mysql_mutex_init(0, &m_mutex, nullptr);
LEVEL_MAP_INSERT(SYNC_UNKNOWN);
LEVEL_MAP_INSERT(RW_LOCK_SX);
@@ -439,7 +426,6 @@ LatchDebug::LatchDebug()
LEVEL_MAP_INSERT(RW_LOCK_S);
LEVEL_MAP_INSERT(RW_LOCK_X);
LEVEL_MAP_INSERT(RW_LOCK_NOT_LOCKED);
- LEVEL_MAP_INSERT(SYNC_MONITOR_MUTEX);
LEVEL_MAP_INSERT(SYNC_ANY_LATCH);
LEVEL_MAP_INSERT(SYNC_BUF_PAGE_HASH);
LEVEL_MAP_INSERT(SYNC_SEARCH_SYS);
@@ -504,7 +490,7 @@ LatchDebug::crash(
latch_level_t level) const
UNIV_NOTHROW
{
- const latch_t* latch = latched->m_latch;
+ const rw_lock_t* latch = latched->m_latch;
const std::string& in_level_name = get_level_name(level);
const std::string& latch_level_name =
@@ -584,7 +570,7 @@ Latches*
LatchDebug::thread_latches(bool add)
UNIV_NOTHROW
{
- m_mutex.enter();
+ mysql_mutex_lock(&m_mutex);
os_thread_id_t thread_id = os_thread_get_curr_id();
ThreadMap::iterator lb = m_threads.lower_bound(thread_id);
@@ -594,16 +580,13 @@ LatchDebug::thread_latches(bool add)
Latches* latches = lb->second;
- m_mutex.exit();
+ mysql_mutex_unlock(&m_mutex);
return(latches);
} else if (!add) {
-
- m_mutex.exit();
-
+ mysql_mutex_unlock(&m_mutex);
return(NULL);
-
} else {
typedef ThreadMap::value_type value_type;
@@ -614,8 +597,7 @@ LatchDebug::thread_latches(bool add)
latches->reserve(32);
m_threads.insert(lb, value_type(thread_id, latches));
-
- m_mutex.exit();
+ mysql_mutex_unlock(&m_mutex);
return(latches);
}
@@ -625,28 +607,22 @@ LatchDebug::thread_latches(bool add)
@param[in] levels the thread's existing (acquired) latches
@param[in] level to lookup
@return latch if found or 0 */
-const latch_t*
+const rw_lock_t*
LatchDebug::find(
const Latches* latches,
latch_level_t level) const UNIV_NOTHROW
{
- Latches::const_iterator end = latches->end();
-
- for (Latches::const_iterator it = latches->begin(); it != end; ++it) {
-
- if (it->m_level == level) {
-
- return(it->m_latch);
- }
- }
-
- return(0);
+ if (latches)
+ for (const Latched &l : *latches)
+ if (l.m_level == level)
+ return l.m_latch;
+ return nullptr;
}
/** Checks if the level value exists in the thread's acquired latches.
@param[in] level The level to lookup
@return latch if found or NULL */
-const latch_t*
+const rw_lock_t*
LatchDebug::find(latch_level_t level)
UNIV_NOTHROW
{
@@ -662,7 +638,7 @@ against other latch levels stored in the array for this thread.
@return the thread's latches */
Latches*
LatchDebug::check_order(
- const latch_t* latch,
+ const rw_lock_t* latch,
latch_level_t level)
UNIV_NOTHROW
{
@@ -698,7 +674,6 @@ LatchDebug::check_order(
/* Fall through */
- case SYNC_MONITOR_MUTEX:
case SYNC_SEARCH_SYS:
case SYNC_PURGE_LATCH:
case SYNC_DICT_OPERATION:
@@ -836,14 +811,9 @@ LatchDebug::check_order(
not found, as we presently are not able to determine the level for
every latch reservation the program does */
void
-LatchDebug::unlock(const latch_t* latch)
+LatchDebug::unlock(const rw_lock_t* latch)
UNIV_NOTHROW
{
- if (latch->get_level() == SYNC_LEVEL_VARYING) {
- // We don't have varying level mutexes
- ut_ad(latch->m_rw_lock);
- }
-
Latches* latches;
if (*latch->get_name() == '.') {
@@ -875,17 +845,12 @@ LatchDebug::unlock(const latch_t* latch)
This could be expensive. */
if (latches->empty()) {
-
- m_mutex.enter();
-
- os_thread_id_t thread_id;
-
+ os_thread_id_t thread_id;
thread_id = os_thread_get_curr_id();
+ mysql_mutex_lock(&m_mutex);
m_threads.erase(thread_id);
-
- m_mutex.exit();
-
+ mysql_mutex_unlock(&m_mutex);
UT_DELETE(latches);
}
@@ -962,7 +927,7 @@ sync_latch_get_name(latch_level_t level)
/** Check if it is OK to acquire the latch.
@param[in] latch latch type */
void
-sync_check_lock_validate(const latch_t* latch)
+sync_check_lock_validate(const rw_lock_t* latch)
{
if (LatchDebug::instance() != NULL) {
LatchDebug::instance()->lock_validate(
@@ -973,7 +938,7 @@ sync_check_lock_validate(const latch_t* latch)
/** Note that the lock has been granted
@param[in] latch latch type */
void
-sync_check_lock_granted(const latch_t* latch)
+sync_check_lock_granted(const rw_lock_t* latch)
{
if (LatchDebug::instance() != NULL) {
LatchDebug::instance()->lock_granted(latch, latch->get_level());
@@ -985,7 +950,7 @@ sync_check_lock_granted(const latch_t* latch)
@param[in] level Latch level */
void
sync_check_lock(
- const latch_t* latch,
+ const rw_lock_t* latch,
latch_level_t level)
{
if (LatchDebug::instance() != NULL) {
@@ -1001,7 +966,7 @@ sync_check_lock(
/** Check if it is OK to re-acquire the lock.
@param[in] latch RW-LOCK to relock (recursive X locks) */
void
-sync_check_relock(const latch_t* latch)
+sync_check_relock(const rw_lock_t* latch)
{
if (LatchDebug::instance() != NULL) {
LatchDebug::instance()->relock(latch);
@@ -1011,7 +976,7 @@ sync_check_relock(const latch_t* latch)
/** Removes a latch from the thread level array if it is found there.
@param[in] latch The latch to unlock */
void
-sync_check_unlock(const latch_t* latch)
+sync_check_unlock(const rw_lock_t* latch)
{
if (LatchDebug::instance() != NULL) {
LatchDebug::instance()->unlock(latch);
@@ -1022,7 +987,7 @@ sync_check_unlock(const latch_t* latch)
mutex or rw-latch at the specified level.
@param[in] level to find
@return a matching latch, or NULL if not found */
-const latch_t*
+const rw_lock_t*
sync_check_find(latch_level_t level)
{
if (LatchDebug::instance() != NULL) {
@@ -1109,25 +1074,11 @@ void
sync_latch_meta_init()
UNIV_NOTHROW
{
- latch_meta.resize(LATCH_ID_MAX);
+ latch_meta.resize(LATCH_ID_MAX + 1);
/* The latches should be ordered on latch_id_t. So that we can
index directly into the vector to update and fetch meta-data. */
- LATCH_ADD_MUTEX(MUTEX_LIST, SYNC_NO_ORDER_CHECK, mutex_list_mutex_key);
-
- LATCH_ADD_MUTEX(RW_LOCK_MUTEX, SYNC_NO_ORDER_CHECK, rw_lock_mutex_key);
-
-#ifndef PFS_SKIP_EVENT_MUTEX
- LATCH_ADD_MUTEX(EVENT_MANAGER, SYNC_NO_ORDER_CHECK,
- event_manager_mutex_key);
-#else
- LATCH_ADD_MUTEX(EVENT_MANAGER, SYNC_NO_ORDER_CHECK,
- PFS_NOT_INSTRUMENTED);
-#endif /* !PFS_SKIP_EVENT_MUTEX */
-
- LATCH_ADD_MUTEX(EVENT_MUTEX, SYNC_NO_ORDER_CHECK, event_mutex_key);
-
// Add the RW locks
LATCH_ADD_RWLOCK(BTR_SEARCH, SYNC_SEARCH_SYS, btr_search_latch_key);
@@ -1157,9 +1108,6 @@ sync_latch_meta_init()
LATCH_ADD_RWLOCK(DICT_TABLE_STATS, SYNC_INDEX_TREE,
dict_table_stats_key);
- LATCH_ADD_MUTEX(SYNC_DEBUG_MUTEX, SYNC_NO_ORDER_CHECK,
- PFS_NOT_INSTRUMENTED);
-
latch_id_t id = LATCH_ID_NONE;
/* The array should be ordered on latch ID.We need to
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index 8c829eef3be..c5a1aedf3e1 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -203,8 +203,6 @@ rw_lock_create_func(
lock->writer_thread= 0;
#ifdef UNIV_DEBUG
- lock->m_rw_lock = true;
-
UT_LIST_INIT(lock->debug_list, &rw_lock_debug_t::list);
lock->m_id = sync_latch_get_id(sync_latch_get_name(level));
diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc
index 5f32d7adf45..9aa35832c9b 100644
--- a/storage/innobase/sync/sync0sync.cc
+++ b/storage/innobase/sync/sync0sync.cc
@@ -51,7 +51,6 @@ mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key;
mysql_pfs_key_t log_sys_mutex_key;
mysql_pfs_key_t log_cmdq_mutex_key;
mysql_pfs_key_t log_flush_order_mutex_key;
-mysql_pfs_key_t mutex_list_mutex_key;
mysql_pfs_key_t recalc_pool_mutex_key;
mysql_pfs_key_t purge_sys_pq_mutex_key;
mysql_pfs_key_t recv_sys_mutex_key;
@@ -65,7 +64,6 @@ mysql_pfs_key_t rtr_active_mutex_key;
mysql_pfs_key_t rtr_match_mutex_key;
mysql_pfs_key_t rtr_path_mutex_key;
mysql_pfs_key_t rw_lock_list_mutex_key;
-mysql_pfs_key_t rw_lock_mutex_key;
mysql_pfs_key_t srv_innodb_monitor_mutex_key;
mysql_pfs_key_t srv_misc_tmpfile_mutex_key;
mysql_pfs_key_t srv_monitor_file_mutex_key;
@@ -77,8 +75,6 @@ mysql_pfs_key_t lock_mutex_key;
mysql_pfs_key_t lock_wait_mutex_key;
mysql_pfs_key_t trx_sys_mutex_key;
mysql_pfs_key_t srv_threads_mutex_key;
-mysql_pfs_key_t event_mutex_key;
-mysql_pfs_key_t event_manager_mutex_key;
mysql_pfs_key_t sync_array_mutex_key;
mysql_pfs_key_t thread_mutex_key;
mysql_pfs_key_t row_drop_list_mutex_key;
@@ -174,21 +170,3 @@ sync_basename(const char* filename)
return(ptr);
}
-
-/** String representation of the filename and line number where the
-latch was created
-@param[in] id Latch ID
-@param[in] created Filename and line number where it was crated
-@return the string representation */
-std::string
-sync_mutex_to_string(
- latch_id_t id,
- const std::string& created)
-{
- std::ostringstream msg;
-
- msg << "Mutex " << sync_latch_get_name(id) << " "
- << "created " << created;
-
- return(msg.str());
-}