msvcr110: Add _Lock_shared_ptr_spin_lock implementation.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2017-02-28 11:21:12 +01:00 committed by Alexandre Julliard
parent 3b9e9dd06a
commit 26d30c6315
2 changed files with 23 additions and 2 deletions

View File

@ -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()

View File

@ -1018,6 +1018,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)
*