Piotr Caban : msvcrt: Throw improper_lock exception in critical_section:: lock and try_lock_for.

Alexandre Julliard julliard at winehq.org
Mon Mar 27 15:26:08 CDT 2017


Module: wine
Branch: master
Commit: c03b7fd9cb416ef5a4bd44729ac234ef71481553
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c03b7fd9cb416ef5a4bd44729ac234ef71481553

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Mar 27 10:28:29 2017 +0200

msvcrt: Throw improper_lock exception in critical_section::lock and try_lock_for.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/lock.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/dlls/msvcrt/lock.c b/dlls/msvcrt/lock.c
index f4cf558..8e2bcc9 100644
--- a/dlls/msvcrt/lock.c
+++ b/dlls/msvcrt/lock.c
@@ -366,10 +366,8 @@ void __thiscall critical_section_lock(critical_section *this)
 
     TRACE("(%p)\n", this);
 
-    if(this->unk_thread_id == GetCurrentThreadId()) {
-        FIXME("throw exception\n");
-        return;
-    }
+    if(this->unk_thread_id == GetCurrentThreadId())
+        throw_exception(EXCEPTION_IMPROPER_LOCK, 0, "Already locked");
 
     memset(&q, 0, sizeof(q));
     last = InterlockedExchangePointer(&this->tail, &q);
@@ -394,10 +392,8 @@ MSVCRT_bool __thiscall critical_section_try_lock(critical_section *this)
 
     TRACE("(%p)\n", this);
 
-    if(this->unk_thread_id == GetCurrentThreadId()) {
-        FIXME("throw exception\n");
+    if(this->unk_thread_id == GetCurrentThreadId())
         return FALSE;
-    }
 
     memset(&q, 0, sizeof(q));
     if(!InterlockedCompareExchangePointer(&this->tail, &q, NULL)) {
@@ -466,10 +462,8 @@ MSVCRT_bool __thiscall critical_section_try_lock_for(
 
     TRACE("(%p %d)\n", this, timeout);
 
-    if(this->unk_thread_id == GetCurrentThreadId()) {
-        FIXME("throw exception\n");
-        return FALSE;
-    }
+    if(this->unk_thread_id == GetCurrentThreadId())
+        throw_exception(EXCEPTION_IMPROPER_LOCK, 0, "Already locked");
 
     if(!(q = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*q))))
         return critical_section_try_lock(this);




More information about the wine-cvs mailing list