summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-02-01 15:51:23 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-02-01 15:51:31 +0300
commitc55bee1961b51c61266e38eda13132e0ef7ae11a (patch)
tree0c5242d4adb9e8427895cdc775ff5f6295d691e6 /src/mir_core
parenta27c3e002e6e5951219e25ecc9662026d1f6fc47 (diff)
attempt to fix #2139
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/locks.cpp46
-rw-r--r--src/mir_core/src/mir_core.def5
-rw-r--r--src/mir_core/src/mir_core64.def5
3 files changed, 56 insertions, 0 deletions
diff --git a/src/mir_core/src/locks.cpp b/src/mir_core/src/locks.cpp
new file mode 100644
index 0000000000..2a53d0051a
--- /dev/null
+++ b/src/mir_core/src/locks.cpp
@@ -0,0 +1,46 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (C) 2012-20 Miranda NG team (https://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+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; either version 2
+of the License, or (at your option) any later version.
+
+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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "stdafx.h"
+
+mir_cs::mir_cs()
+{
+ ::InitializeCriticalSection(&m_cs);
+}
+
+mir_cs::~mir_cs()
+{
+ ::DeleteCriticalSection(&m_cs);
+}
+
+void mir_cs::Lock()
+{
+ while (!::TryEnterCriticalSection(&m_cs))
+ ::SleepEx(50, TRUE);
+}
+
+void mir_cs::Unlock()
+{
+ ::LeaveCriticalSection(&m_cs);
+}
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 7254c631aa..d233b605ec 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1452,3 +1452,8 @@ XmlGetChildText @1645
?RemoveControl@CDlgBase@@IAEXPAVCCtrlBase@@@Z @1667 NONAME
?assign@MBinBuffer@@QAEXPAXI@Z @1668 NONAME
?GetHwnd@CTimer@@QBEPAUHWND__@@XZ @1669 NONAME
+??0MNonCopyable@@QAE@XZ @1670 NONAME
+??0mir_cs@@QAE@XZ @1671 NONAME
+??1mir_cs@@QAE@XZ @1672 NONAME
+?Lock@mir_cs@@QAEXXZ @1673 NONAME
+?Unlock@mir_cs@@QAEXXZ @1674 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 1aca6aa620..b589947f72 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1452,3 +1452,8 @@ XmlGetChildText @1645
?RemoveControl@CDlgBase@@IEAAXPEAVCCtrlBase@@@Z @1667 NONAME
?assign@MBinBuffer@@QEAAXPEAX_K@Z @1668 NONAME
?GetHwnd@CTimer@@QEBAPEAUHWND__@@XZ @1669 NONAME
+??0MNonCopyable@@QEAA@XZ @1670 NONAME
+??0mir_cs@@QEAA@XZ @1671 NONAME
+??1mir_cs@@QEAA@XZ @1672 NONAME
+?Lock@mir_cs@@QEAAXXZ @1673 NONAME
+?Unlock@mir_cs@@QEAAXXZ @1674 NONAME