From d899bdcb9bbf1b52f91daabacfb630059757fcea Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Aug 2014 19:52:03 +0100 Subject: Remove lock in MySQLFramework. This is not necessary as the connection is not shared. --- OpenSim/Data/MySQL/MySQLFramework.cs | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs index 3fdcf1e..5820a90 100644 --- a/OpenSim/Data/MySQL/MySQLFramework.cs +++ b/OpenSim/Data/MySQL/MySQLFramework.cs @@ -45,38 +45,29 @@ namespace OpenSim.Data.MySQL System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); protected string m_connectionString; - protected object m_dbLock = new object(); protected MySqlFramework(string connectionString) { m_connectionString = connectionString; } - ////////////////////////////////////////////////////////////// - // - // All non queries are funneled through one connection - // to increase performance a little - // protected int ExecuteNonQuery(MySqlCommand cmd) { - lock (m_dbLock) + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - cmd.Connection = dbcon; + dbcon.Open(); + cmd.Connection = dbcon; - try - { - return cmd.ExecuteNonQuery(); - } - catch (Exception e) - { - m_log.Error(e.Message, e); - return 0; - } + try + { + return cmd.ExecuteNonQuery(); + } + catch (Exception e) + { + m_log.Error(e.Message, e); + return 0; } } } } -} +} \ No newline at end of file -- cgit v1.1