Piotr Caban : msvcr110: Add _Lock_shared_ptr_spin_lock implementation.

Alexandre Julliard julliard at winehq.org
Thu Jul 20 12:11:29 CDT 2017


Module: wine
Branch: stable
Commit: 2ceee36e0185378f336570371773b198ed267942
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2ceee36e0185378f336570371773b198ed267942

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Feb 28 11:21:12 2017 +0100

msvcr110: Add _Lock_shared_ptr_spin_lock implementation.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 26d30c63154c5fb3258fd6d24959c12052999c7f)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/msvcr110/msvcr110.spec |  4 ++--
 dlls/msvcrt/lock.c          | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec
index a73f18d..768bf8b 100644
--- a/dlls/msvcr110/msvcr110.spec
+++ b/dlls/msvcr110/msvcr110.spec
@@ -854,7 +854,7 @@
 @ cdecl _Gettnames()
 @ extern _HUGE MSVCRT__HUGE
 @ cdecl _IsExceptionObjectToBeDestroyed(ptr)
-@ stub _Lock_shared_ptr_spin_lock
+@ cdecl _Lock_shared_ptr_spin_lock()
 @ stub -arch=i386 _NLG_Dispatch2
 @ stub -arch=arm,win64 __NLG_Dispatch2
 @ stub -arch=i386 _NLG_Return
@@ -863,7 +863,7 @@
 @ stub -arch=win64 _SetImageBase
 @ stub -arch=win64 _SetThrowImageBase
 @ cdecl _Strftime(str long str ptr ptr)
-@ stub _Unlock_shared_ptr_spin_lock
+@ cdecl _Unlock_shared_ptr_spin_lock()
 @ cdecl _W_Getdays()
 @ cdecl _W_Getmonths()
 @ cdecl _W_Gettnames()
diff --git a/dlls/msvcrt/lock.c b/dlls/msvcrt/lock.c
index d81967c..308c6fc 100644
--- a/dlls/msvcrt/lock.c
+++ b/dlls/msvcrt/lock.c
@@ -912,6 +912,27 @@ MSVCRT_bool __thiscall _ReentrantBlockingLock__TryAcquire(_ReentrantBlockingLock
 }
 #endif
 
+#if _MSVCR_VER == 110
+static LONG shared_ptr_lock;
+
+void __cdecl _Lock_shared_ptr_spin_lock(void)
+{
+    LONG l = 0;
+
+    while(InterlockedCompareExchange(&shared_ptr_lock, 1, 0) != 0) {
+        if(l++ == 1000) {
+            Sleep(0);
+            l = 0;
+        }
+    }
+}
+
+void __cdecl _Unlock_shared_ptr_spin_lock(void)
+{
+    shared_ptr_lock = 0;
+}
+#endif
+
 /**********************************************************************
  *     msvcrt_free_locks (internal)
  *




More information about the wine-cvs mailing list