summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_system_cpp.h16
-rw-r--r--libs/win32/mir_core.libbin461946 -> 463074 bytes
-rw-r--r--libs/win64/mir_core.libbin466756 -> 467908 bytes
-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
6 files changed, 63 insertions, 9 deletions
diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h
index 9099128224..a65aa9fba4 100644
--- a/include/m_system_cpp.h
+++ b/include/m_system_cpp.h
@@ -39,9 +39,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
///////////////////////////////////////////////////////////////////////////////
// general lists' templates
-struct MNonCopyable
+struct MIR_CORE_EXPORT MNonCopyable
{
- MNonCopyable() {}
+ __inline MNonCopyable() {}
MNonCopyable(const MNonCopyable&) = delete;
MNonCopyable& operator=(const MNonCopyable&) = delete;
@@ -73,18 +73,16 @@ typedef mir_ptr<wchar_t> ptrW;
///////////////////////////////////////////////////////////////////////////////
// mir_cs - simple wrapper for the critical sections
-class mir_cs
+class MIR_CORE_EXPORT mir_cs : public MNonCopyable
{
CRITICAL_SECTION m_cs;
public:
- __inline mir_cs() { ::InitializeCriticalSection(&m_cs); }
- __inline ~mir_cs() { ::DeleteCriticalSection(&m_cs); }
+ mir_cs();
+ ~mir_cs();
- __inline void Lock() { ::EnterCriticalSection(&m_cs); }
- __inline void Unlock() { ::LeaveCriticalSection(&m_cs); }
-
- __inline operator CRITICAL_SECTION&() { return m_cs; }
+ void Lock();
+ void Unlock();
};
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib
index cdef77acdf..7ec5e8210a 100644
--- a/libs/win32/mir_core.lib
+++ b/libs/win32/mir_core.lib
Binary files differ
diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib
index 6d748e5001..586e45e019 100644
--- a/libs/win64/mir_core.lib
+++ b/libs/win64/mir_core.lib
Binary files differ
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