msvcrt: Add improper_lock class implementation.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0a1a6533b5
commit
de600ada77
|
@ -76,10 +76,10 @@
|
|||
@ stub -arch=win64 ??0default_scheduler_exists@Concurrency@@QEAA@XZ
|
||||
@ thiscall -arch=win32 ??0event@Concurrency@@QAE@XZ(ptr) msvcr120.??0event@Concurrency@@QAE@XZ
|
||||
@ cdecl -arch=win64 ??0event@Concurrency@@QEAA@XZ(ptr) msvcr120.??0event@Concurrency@@QEAA@XZ
|
||||
@ stub -arch=i386 ??0improper_lock@Concurrency@@QAE@PBD@Z
|
||||
@ stub -arch=win64 ??0improper_lock@Concurrency@@QEAA@PEBD@Z
|
||||
@ stub -arch=i386 ??0improper_lock@Concurrency@@QAE@XZ
|
||||
@ stub -arch=win64 ??0improper_lock@Concurrency@@QEAA@XZ
|
||||
@ thiscall -arch=i386 ??0improper_lock@Concurrency@@QAE@PBD@Z(ptr str) msvcr120.??0improper_lock@Concurrency@@QAE@PBD@Z
|
||||
@ cdecl -arch=win64 ??0improper_lock@Concurrency@@QEAA@PEBD@Z(ptr str) msvcr120.??0improper_lock@Concurrency@@QEAA@PEBD@Z
|
||||
@ thiscall -arch=i386 ??0improper_lock@Concurrency@@QAE@XZ(ptr) msvcr120.??0improper_lock@Concurrency@@QAE@XZ
|
||||
@ cdecl -arch=win64 ??0improper_lock@Concurrency@@QEAA@XZ(ptr) msvcr120.??0improper_lock@Concurrency@@QEAA@XZ
|
||||
@ stub -arch=i386 ??0improper_scheduler_attach@Concurrency@@QAE@PBD@Z
|
||||
@ stub -arch=win64 ??0improper_scheduler_attach@Concurrency@@QEAA@PEBD@Z
|
||||
@ stub -arch=i386 ??0improper_scheduler_attach@Concurrency@@QAE@XZ
|
||||
|
|
|
@ -74,10 +74,10 @@
|
|||
@ cdecl -arch=win64 ??0exception@std@@QEAA@AEBV01@@Z(ptr ptr) MSVCRT_exception_copy_ctor
|
||||
@ thiscall -arch=i386 ??0exception@std@@QAE@XZ(ptr) MSVCRT_exception_default_ctor
|
||||
@ cdecl -arch=win64 ??0exception@std@@QEAA@XZ(ptr) MSVCRT_exception_default_ctor
|
||||
@ stub -arch=win32 ??0improper_lock@Concurrency@@QAE@PBD@Z
|
||||
@ stub -arch=win64 ??0improper_lock@Concurrency@@QEAA@PEBD@Z
|
||||
@ stub -arch=win32 ??0improper_lock@Concurrency@@QAE@XZ
|
||||
@ stub -arch=win64 ??0improper_lock@Concurrency@@QEAA@XZ
|
||||
@ thiscall -arch=i386 ??0improper_lock@Concurrency@@QAE@PBD@Z(ptr str) improper_lock_ctor_str
|
||||
@ cdecl -arch=win64 ??0improper_lock@Concurrency@@QEAA@PEBD@Z(ptr str) improper_lock_ctor_str
|
||||
@ thiscall -arch=i386 ??0improper_lock@Concurrency@@QAE@XZ(ptr) improper_lock_ctor
|
||||
@ cdecl -arch=win64 ??0improper_lock@Concurrency@@QEAA@XZ(ptr) improper_lock_ctor
|
||||
@ stub -arch=win32 ??0improper_scheduler_attach@Concurrency@@QAE@PBD@Z
|
||||
@ stub -arch=win64 ??0improper_scheduler_attach@Concurrency@@QEAA@PEBD@Z
|
||||
@ stub -arch=win32 ??0improper_scheduler_attach@Concurrency@@QAE@XZ
|
||||
|
|
|
@ -137,12 +137,12 @@
|
|||
@ cdecl -arch=arm ??0exception@std@@QAA@XZ(ptr) MSVCRT_exception_default_ctor
|
||||
@ thiscall -arch=i386 ??0exception@std@@QAE@XZ(ptr) MSVCRT_exception_default_ctor
|
||||
@ cdecl -arch=win64 ??0exception@std@@QEAA@XZ(ptr) MSVCRT_exception_default_ctor
|
||||
@ stub -arch=arm ??0improper_lock@Concurrency@@QAA@PBD@Z
|
||||
@ stub -arch=i386 ??0improper_lock@Concurrency@@QAE@PBD@Z
|
||||
@ stub -arch=win64 ??0improper_lock@Concurrency@@QEAA@PEBD@Z
|
||||
@ stub -arch=arm ??0improper_lock@Concurrency@@QAA@XZ
|
||||
@ stub -arch=i386 ??0improper_lock@Concurrency@@QAE@XZ
|
||||
@ stub -arch=win64 ??0improper_lock@Concurrency@@QEAA@XZ
|
||||
@ cdecl -arch=arm ??0improper_lock@Concurrency@@QAA@PBD@Z(ptr str) improper_lock_ctor_str
|
||||
@ thiscall -arch=i386 ??0improper_lock@Concurrency@@QAE@PBD@Z(ptr str) improper_lock_ctor_str
|
||||
@ cdecl -arch=win64 ??0improper_lock@Concurrency@@QEAA@PEBD@Z(ptr str) improper_lock_ctor_str
|
||||
@ cdecl -arch=arm ??0improper_lock@Concurrency@@QAA@XZ(ptr) improper_lock_ctor
|
||||
@ thiscall -arch=i386 ??0improper_lock@Concurrency@@QAE@XZ(ptr) improper_lock_ctor
|
||||
@ cdecl -arch=win64 ??0improper_lock@Concurrency@@QEAA@XZ(ptr) improper_lock_ctor
|
||||
@ stub -arch=arm ??0improper_scheduler_attach@Concurrency@@QAA@PBD@Z
|
||||
@ stub -arch=i386 ??0improper_scheduler_attach@Concurrency@@QAE@PBD@Z
|
||||
@ stub -arch=win64 ??0improper_scheduler_attach@Concurrency@@QEAA@PEBD@Z
|
||||
|
|
|
@ -134,12 +134,12 @@
|
|||
@ cdecl -arch=arm ??0exception@std@@QAA@XZ(ptr) MSVCRT_exception_default_ctor
|
||||
@ thiscall -arch=i386 ??0exception@std@@QAE@XZ(ptr) MSVCRT_exception_default_ctor
|
||||
@ cdecl -arch=win64 ??0exception@std@@QEAA@XZ(ptr) MSVCRT_exception_default_ctor
|
||||
@ stub -arch=arm ??0improper_lock@Concurrency@@QAA@PBD@Z
|
||||
@ stub -arch=i386 ??0improper_lock@Concurrency@@QAE@PBD@Z
|
||||
@ stub -arch=win64 ??0improper_lock@Concurrency@@QEAA@PEBD@Z
|
||||
@ stub -arch=arm ??0improper_lock@Concurrency@@QAA@XZ
|
||||
@ stub -arch=i386 ??0improper_lock@Concurrency@@QAE@XZ
|
||||
@ stub -arch=win64 ??0improper_lock@Concurrency@@QEAA@XZ
|
||||
@ cdecl -arch=arm ??0improper_lock@Concurrency@@QAA@PBD@Z(ptr str) improper_lock_ctor_str
|
||||
@ thiscall -arch=i386 ??0improper_lock@Concurrency@@QAE@PBD@Z(ptr str) improper_lock_ctor_str
|
||||
@ cdecl -arch=win64 ??0improper_lock@Concurrency@@QEAA@PEBD@Z(ptr str) improper_lock_ctor_str
|
||||
@ cdecl -arch=arm ??0improper_lock@Concurrency@@QAA@XZ(ptr) improper_lock_ctor
|
||||
@ thiscall -arch=i386 ??0improper_lock@Concurrency@@QAE@XZ(ptr) improper_lock_ctor
|
||||
@ cdecl -arch=win64 ??0improper_lock@Concurrency@@QEAA@XZ(ptr) improper_lock_ctor
|
||||
@ stub -arch=arm ??0improper_scheduler_attach@Concurrency@@QAA@PBD@Z
|
||||
@ stub -arch=i386 ??0improper_scheduler_attach@Concurrency@@QAE@PBD@Z
|
||||
@ stub -arch=win64 ??0improper_scheduler_attach@Concurrency@@QEAA@PEBD@Z
|
||||
|
|
|
@ -132,12 +132,12 @@
|
|||
@ cdecl -arch=arm ??0exception@std@@QAA@XZ(ptr) msvcr120.??0exception@std@@QAA@XZ
|
||||
@ thiscall -arch=i386 ??0exception@std@@QAE@XZ(ptr) msvcr120.??0exception@std@@QAE@XZ
|
||||
@ cdecl -arch=win64 ??0exception@std@@QEAA@XZ(ptr) msvcr120.??0exception@std@@QEAA@XZ
|
||||
@ stub -arch=arm ??0improper_lock@Concurrency@@QAA@PBD@Z
|
||||
@ stub -arch=i386 ??0improper_lock@Concurrency@@QAE@PBD@Z
|
||||
@ stub -arch=win64 ??0improper_lock@Concurrency@@QEAA@PEBD@Z
|
||||
@ stub -arch=arm ??0improper_lock@Concurrency@@QAA@XZ
|
||||
@ stub -arch=i386 ??0improper_lock@Concurrency@@QAE@XZ
|
||||
@ stub -arch=win64 ??0improper_lock@Concurrency@@QEAA@XZ
|
||||
@ cdecl -arch=arm ??0improper_lock@Concurrency@@QAA@PBD@Z(ptr str) msvcr120.??0improper_lock@Concurrency@@QAA@PBD@Z
|
||||
@ thiscall -arch=i386 ??0improper_lock@Concurrency@@QAE@PBD@Z(ptr str) msvcr120.??0improper_lock@Concurrency@@QAE@PBD@Z
|
||||
@ cdecl -arch=win64 ??0improper_lock@Concurrency@@QEAA@PEBD@Z(ptr str) msvcr120.??0improper_lock@Concurrency@@QEAA@PEBD@Z
|
||||
@ cdecl -arch=arm ??0improper_lock@Concurrency@@QAA@XZ(ptr) msvcr120.??0improper_lock@Concurrency@@QAA@XZ
|
||||
@ thiscall -arch=i386 ??0improper_lock@Concurrency@@QAE@XZ(ptr) msvcr120.??0improper_lock@Concurrency@@QAE@XZ
|
||||
@ cdecl -arch=win64 ??0improper_lock@Concurrency@@QEAA@XZ(ptr) msvcr120.??0improper_lock@Concurrency@@QEAA@XZ
|
||||
@ stub -arch=arm ??0improper_scheduler_attach@Concurrency@@QAA@PBD@Z
|
||||
@ stub -arch=i386 ??0improper_scheduler_attach@Concurrency@@QAE@PBD@Z
|
||||
@ stub -arch=win64 ??0improper_scheduler_attach@Concurrency@@QEAA@PEBD@Z
|
||||
|
|
|
@ -737,6 +737,44 @@ void __thiscall MSVCRT_scheduler_resource_allocation_error_dtor(
|
|||
TRACE("(%p)\n", this);
|
||||
MSVCRT_exception_dtor(&this->e);
|
||||
}
|
||||
|
||||
typedef exception improper_lock;
|
||||
extern const vtable_ptr MSVCRT_improper_lock_vtable;
|
||||
|
||||
/* ??0improper_lock@Concurrency@@QAE@PBD@Z */
|
||||
/* ??0improper_lock@Concurrency@@QEAA@PEBD@Z */
|
||||
DEFINE_THISCALL_WRAPPER(improper_lock_ctor_str, 8)
|
||||
improper_lock* __thiscall improper_lock_ctor_str(improper_lock *this, const char *str)
|
||||
{
|
||||
TRACE("(%p %p)\n", this, str);
|
||||
MSVCRT_exception_ctor(this, &str);
|
||||
this->vtable = &MSVCRT_improper_lock_vtable;
|
||||
return this;
|
||||
}
|
||||
|
||||
/* ??0improper_lock@Concurrency@@QAE@XZ */
|
||||
/* ??0improper_lock@Concurrency@@QEAA@XZ */
|
||||
DEFINE_THISCALL_WRAPPER(improper_lock_ctor, 4)
|
||||
improper_lock* __thiscall improper_lock_ctor(improper_lock *this)
|
||||
{
|
||||
return improper_lock_ctor_str(this, NULL);
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(MSVCRT_improper_lock_copy_ctor,8)
|
||||
improper_lock * __thiscall MSVCRT_improper_lock_copy_ctor(improper_lock * _this, const improper_lock * rhs)
|
||||
{
|
||||
TRACE("(%p %p)\n", _this, rhs);
|
||||
MSVCRT_exception_copy_ctor(_this, rhs);
|
||||
_this->vtable = &MSVCRT_improper_lock_vtable;
|
||||
return _this;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(MSVCRT_improper_lock_dtor,4)
|
||||
void __thiscall MSVCRT_improper_lock_dtor(improper_lock * _this)
|
||||
{
|
||||
TRACE("(%p)\n", _this);
|
||||
MSVCRT_exception_dtor(_this);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __GNUC__
|
||||
|
@ -769,6 +807,9 @@ __ASM_VTABLE(__non_rtti_object,
|
|||
__ASM_VTABLE(scheduler_resource_allocation_error,
|
||||
VTABLE_ADD_FUNC(MSVCRT_exception_vector_dtor)
|
||||
VTABLE_ADD_FUNC(MSVCRT_what_exception));
|
||||
__ASM_VTABLE(improper_lock,
|
||||
VTABLE_ADD_FUNC(MSVCRT_exception_vector_dtor)
|
||||
VTABLE_ADD_FUNC(MSVCRT_what_exception));
|
||||
#endif
|
||||
|
||||
#ifndef __GNUC__
|
||||
|
@ -792,6 +833,7 @@ DEFINE_RTTI_DATA2( __non_rtti_object, 0, &bad_typeid_rtti_base_descriptor, &exce
|
|||
#if _MSVCR_VER >= 100
|
||||
DEFINE_RTTI_DATA1(scheduler_resource_allocation_error, 0, &exception_rtti_base_descriptor,
|
||||
".?AVscheduler_resource_allocation_error@Concurrency@@")
|
||||
DEFINE_RTTI_DATA1(improper_lock, 0, &exception_rtti_base_descriptor, ".?AVimproper_lock@Concurrency@@" )
|
||||
#endif
|
||||
|
||||
DEFINE_EXCEPTION_TYPE_INFO( exception, 0, NULL, NULL )
|
||||
|
@ -803,6 +845,7 @@ DEFINE_EXCEPTION_TYPE_INFO( bad_alloc, 1, &exception_cxx_type_info, NULL )
|
|||
#endif
|
||||
#if _MSVCR_VER >= 100
|
||||
DEFINE_EXCEPTION_TYPE_INFO(scheduler_resource_allocation_error, 1, &exception_cxx_type_info, NULL)
|
||||
DEFINE_EXCEPTION_TYPE_INFO(improper_lock, 1, &exception_cxx_type_info, NULL)
|
||||
#endif
|
||||
|
||||
void msvcrt_init_exception(void *base)
|
||||
|
@ -819,6 +862,7 @@ void msvcrt_init_exception(void *base)
|
|||
init___non_rtti_object_rtti(base);
|
||||
#if _MSVCR_VER >= 100
|
||||
init_scheduler_resource_allocation_error_rtti(base);
|
||||
init_improper_lock_rtti(base);
|
||||
#endif
|
||||
|
||||
init_exception_cxx(base);
|
||||
|
@ -830,6 +874,7 @@ void msvcrt_init_exception(void *base)
|
|||
#endif
|
||||
#if _MSVCR_VER >= 100
|
||||
init_scheduler_resource_allocation_error_cxx(base);
|
||||
init_improper_lock_cxx(base);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -850,6 +895,13 @@ void throw_scheduler_resource_allocation_error(const char *str, HRESULT hr)
|
|||
scheduler_resource_allocation_error_ctor_name(&e, str, hr);
|
||||
_CxxThrowException(&e.e, &scheduler_resource_allocation_error_exception_type);
|
||||
}
|
||||
|
||||
void throw_improper_lock(const char *str)
|
||||
{
|
||||
improper_lock e;
|
||||
improper_lock_ctor_str(&e, str);
|
||||
_CxxThrowException(&e, &improper_lock_exception_type);
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************
|
||||
|
|
|
@ -1026,7 +1026,7 @@ void __thiscall reader_writer_lock_lock(reader_writer_lock *this)
|
|||
TRACE("(%p)\n", this);
|
||||
|
||||
if (this->thread_id == GetCurrentThreadId())
|
||||
FIXME("throw improper_lock exception\n");
|
||||
throw_improper_lock("Already locked");
|
||||
|
||||
last = InterlockedExchangePointer((void**)&this->writer_tail, &q);
|
||||
if (last) {
|
||||
|
@ -1057,7 +1057,7 @@ void __thiscall reader_writer_lock_lock_read(reader_writer_lock *this)
|
|||
TRACE("(%p)\n", this);
|
||||
|
||||
if (this->thread_id == GetCurrentThreadId())
|
||||
FIXME("throw improper_lock exception\n");
|
||||
throw_improper_lock("Already locked as writer");
|
||||
|
||||
do {
|
||||
q.next = this->reader_head;
|
||||
|
@ -1095,7 +1095,7 @@ MSVCRT_bool __thiscall reader_writer_lock_try_lock(reader_writer_lock *this)
|
|||
TRACE("(%p)\n", this);
|
||||
|
||||
if (this->thread_id == GetCurrentThreadId())
|
||||
FIXME("throw improper_lock exception\n");
|
||||
return FALSE;
|
||||
|
||||
if (InterlockedCompareExchangePointer((void**)&this->writer_tail, &q, NULL))
|
||||
return FALSE;
|
||||
|
|
|
@ -287,6 +287,7 @@ void throw_bad_alloc(const char*) DECLSPEC_HIDDEN;
|
|||
#endif
|
||||
#if _MSVCR_VER >= 100
|
||||
void throw_scheduler_resource_allocation_error(const char*, HRESULT) DECLSPEC_HIDDEN;
|
||||
void throw_improper_lock(const char*) DECLSPEC_HIDDEN;
|
||||
#endif
|
||||
|
||||
void __cdecl _purecall(void);
|
||||
|
|
Loading…
Reference in New Issue