Commit c03b7fd9 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

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

parent e71edd0a
...@@ -366,10 +366,8 @@ void __thiscall critical_section_lock(critical_section *this) ...@@ -366,10 +366,8 @@ void __thiscall critical_section_lock(critical_section *this)
TRACE("(%p)\n", this); TRACE("(%p)\n", this);
if(this->unk_thread_id == GetCurrentThreadId()) { if(this->unk_thread_id == GetCurrentThreadId())
FIXME("throw exception\n"); throw_exception(EXCEPTION_IMPROPER_LOCK, 0, "Already locked");
return;
}
memset(&q, 0, sizeof(q)); memset(&q, 0, sizeof(q));
last = InterlockedExchangePointer(&this->tail, &q); last = InterlockedExchangePointer(&this->tail, &q);
...@@ -394,10 +392,8 @@ MSVCRT_bool __thiscall critical_section_try_lock(critical_section *this) ...@@ -394,10 +392,8 @@ MSVCRT_bool __thiscall critical_section_try_lock(critical_section *this)
TRACE("(%p)\n", this); TRACE("(%p)\n", this);
if(this->unk_thread_id == GetCurrentThreadId()) { if(this->unk_thread_id == GetCurrentThreadId())
FIXME("throw exception\n");
return FALSE; return FALSE;
}
memset(&q, 0, sizeof(q)); memset(&q, 0, sizeof(q));
if(!InterlockedCompareExchangePointer(&this->tail, &q, NULL)) { if(!InterlockedCompareExchangePointer(&this->tail, &q, NULL)) {
...@@ -466,10 +462,8 @@ MSVCRT_bool __thiscall critical_section_try_lock_for( ...@@ -466,10 +462,8 @@ MSVCRT_bool __thiscall critical_section_try_lock_for(
TRACE("(%p %d)\n", this, timeout); TRACE("(%p %d)\n", this, timeout);
if(this->unk_thread_id == GetCurrentThreadId()) { if(this->unk_thread_id == GetCurrentThreadId())
FIXME("throw exception\n"); throw_exception(EXCEPTION_IMPROPER_LOCK, 0, "Already locked");
return FALSE;
}
if(!(q = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*q)))) if(!(q = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*q))))
return critical_section_try_lock(this); return critical_section_try_lock(this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment