Commit 1c9a30f2 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Move improper_scheduler_detach to concurrency.c.

parent 9694fc11
......@@ -305,6 +305,9 @@ extern const vtable_ptr improper_lock_vtable;
typedef exception improper_scheduler_attach;
extern const vtable_ptr improper_scheduler_attach_vtable;
typedef exception improper_scheduler_detach;
extern const vtable_ptr improper_scheduler_detach_vtable;
typedef exception invalid_scheduler_policy_key;
extern const vtable_ptr invalid_scheduler_policy_key_vtable;
......@@ -400,6 +403,33 @@ improper_scheduler_attach * __thiscall improper_scheduler_attach_copy_ctor(
return __exception_copy_ctor(_this, rhs, &improper_scheduler_attach_vtable);
}
/* ??0improper_scheduler_detach@Concurrency@@QAE@PBD@Z */
/* ??0improper_scheduler_detach@Concurrency@@QEAA@PEBD@Z */
DEFINE_THISCALL_WRAPPER(improper_scheduler_detach_ctor_str, 8)
improper_scheduler_detach* __thiscall improper_scheduler_detach_ctor_str(
improper_scheduler_detach *this, const char *str)
{
TRACE("(%p %p)\n", this, str);
return __exception_ctor(this, str, &improper_scheduler_detach_vtable);
}
/* ??0improper_scheduler_detach@Concurrency@@QAE@XZ */
/* ??0improper_scheduler_detach@Concurrency@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(improper_scheduler_detach_ctor, 4)
improper_scheduler_detach* __thiscall improper_scheduler_detach_ctor(
improper_scheduler_detach *this)
{
return improper_scheduler_detach_ctor_str(this, NULL);
}
DEFINE_THISCALL_WRAPPER(improper_scheduler_detach_copy_ctor,8)
improper_scheduler_detach * __thiscall improper_scheduler_detach_copy_ctor(
improper_scheduler_detach * _this, const improper_scheduler_detach * rhs)
{
TRACE("(%p %p)\n", _this, rhs);
return __exception_copy_ctor(_this, rhs, &improper_scheduler_detach_vtable);
}
/* ??0invalid_scheduler_policy_key@Concurrency@@QAE@PBD@Z */
/* ??0invalid_scheduler_policy_key@Concurrency@@QEAA@PEBD@Z */
DEFINE_THISCALL_WRAPPER(invalid_scheduler_policy_key_ctor_str, 8)
......@@ -530,6 +560,8 @@ DEFINE_RTTI_DATA1(improper_lock, 0, &cexception_rtti_base_descriptor,
".?AVimproper_lock@Concurrency@@")
DEFINE_RTTI_DATA1(improper_scheduler_attach, 0, &cexception_rtti_base_descriptor,
".?AVimproper_scheduler_attach@Concurrency@@")
DEFINE_RTTI_DATA1(improper_scheduler_detach, 0, &cexception_rtti_base_descriptor,
".?AVimproper_scheduler_detach@Concurrency@@")
DEFINE_RTTI_DATA1(invalid_scheduler_policy_key, 0, &cexception_rtti_base_descriptor,
".?AVinvalid_scheduler_policy_key@Concurrency@@")
DEFINE_RTTI_DATA1(invalid_scheduler_policy_thread_specification, 0, &cexception_rtti_base_descriptor,
......@@ -541,6 +573,7 @@ DEFINE_RTTI_DATA1(scheduler_resource_allocation_error, 0, &cexception_rtti_base_
DEFINE_CXX_DATA1(improper_lock, &cexception_cxx_type_info, cexception_dtor)
DEFINE_CXX_DATA1(improper_scheduler_attach, &cexception_cxx_type_info, cexception_dtor)
DEFINE_CXX_DATA1(improper_scheduler_detach, &cexception_cxx_type_info, cexception_dtor)
DEFINE_CXX_DATA1(invalid_scheduler_policy_key, &cexception_cxx_type_info, cexception_dtor)
DEFINE_CXX_DATA1(invalid_scheduler_policy_thread_specification, &cexception_cxx_type_info, cexception_dtor)
DEFINE_CXX_DATA1(invalid_scheduler_policy_value, &cexception_cxx_type_info, cexception_dtor)
......@@ -553,6 +586,9 @@ __ASM_BLOCK_BEGIN(concurrency_exception_vtables)
__ASM_VTABLE(improper_scheduler_attach,
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what));
__ASM_VTABLE(improper_scheduler_detach,
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what));
__ASM_VTABLE(invalid_scheduler_policy_key,
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what));
......@@ -1295,16 +1331,22 @@ void __cdecl CurrentScheduler_Detach(void)
TRACE("()\n");
if(!context)
throw_exception(EXCEPTION_IMPROPER_SCHEDULER_DETACH, 0, NULL);
if(!context) {
improper_scheduler_detach e;
improper_scheduler_detach_ctor_str(&e, NULL);
_CxxThrowException(&e, &improper_scheduler_detach_exception_type);
}
if(context->context.vtable != &ExternalContextBase_vtable) {
ERR("unknown context set\n");
return;
}
if(!context->scheduler.next)
throw_exception(EXCEPTION_IMPROPER_SCHEDULER_DETACH, 0, NULL);
if(!context->scheduler.next) {
improper_scheduler_detach e;
improper_scheduler_detach_ctor_str(&e, NULL);
_CxxThrowException(&e, &improper_scheduler_detach_exception_type);
}
call_Scheduler_Release(context->scheduler.scheduler);
if(!context->scheduler.next) {
......@@ -2760,6 +2802,7 @@ void msvcrt_init_concurrency(void *base)
init_cexception_rtti(base);
init_improper_lock_rtti(base);
init_improper_scheduler_attach_rtti(base);
init_improper_scheduler_detach_rtti(base);
init_invalid_scheduler_policy_key_rtti(base);
init_invalid_scheduler_policy_thread_specification_rtti(base);
init_invalid_scheduler_policy_value_rtti(base);
......@@ -2774,6 +2817,7 @@ void msvcrt_init_concurrency(void *base)
init_cexception_cxx_type_info(base);
init_improper_lock_cxx(base);
init_improper_scheduler_attach_cxx(base);
init_improper_scheduler_detach_cxx(base);
init_invalid_scheduler_policy_key_cxx(base);
init_invalid_scheduler_policy_thread_specification_cxx(base);
init_invalid_scheduler_policy_value_cxx(base);
......
......@@ -549,40 +549,6 @@ void __thiscall bad_alloc_dtor(bad_alloc * _this)
#endif /* _MSVCR_VER >= 80 */
#if _MSVCR_VER >= 100
typedef exception improper_scheduler_detach;
extern const vtable_ptr improper_scheduler_detach_vtable;
/* ??0improper_scheduler_detach@Concurrency@@QAE@PBD@Z */
/* ??0improper_scheduler_detach@Concurrency@@QEAA@PEBD@Z */
DEFINE_THISCALL_WRAPPER(improper_scheduler_detach_ctor_str, 8)
improper_scheduler_detach* __thiscall improper_scheduler_detach_ctor_str(
improper_scheduler_detach *this, const char *str)
{
TRACE("(%p %p)\n", this, str);
return __exception_ctor(this, str, &improper_scheduler_detach_vtable);
}
/* ??0improper_scheduler_detach@Concurrency@@QAE@XZ */
/* ??0improper_scheduler_detach@Concurrency@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(improper_scheduler_detach_ctor, 4)
improper_scheduler_detach* __thiscall improper_scheduler_detach_ctor(
improper_scheduler_detach *this)
{
return improper_scheduler_detach_ctor_str(this, NULL);
}
DEFINE_THISCALL_WRAPPER(improper_scheduler_detach_copy_ctor,8)
improper_scheduler_detach * __thiscall improper_scheduler_detach_copy_ctor(
improper_scheduler_detach * _this, const improper_scheduler_detach * rhs)
{
TRACE("(%p %p)\n", _this, rhs);
return __exception_copy_ctor(_this, rhs, &improper_scheduler_detach_vtable);
}
#endif /* _MSVCR_VER >= 100 */
__ASM_BLOCK_BEGIN(vtables)
#if _MSVCR_VER >= 80
......@@ -602,11 +568,6 @@ __ASM_VTABLE(bad_cast,
__ASM_VTABLE(__non_rtti_object,
VTABLE_ADD_FUNC(__non_rtti_object_vector_dtor)
VTABLE_ADD_FUNC(exception_what));
#if _MSVCR_VER >= 100
__ASM_VTABLE(improper_scheduler_detach,
VTABLE_ADD_FUNC(exception_vector_dtor)
VTABLE_ADD_FUNC(exception_what));
#endif
__ASM_BLOCK_END
......@@ -621,10 +582,6 @@ DEFINE_RTTI_DATA1( bad_typeid, 0, &exception_rtti_base_descriptor, ".?AVbad_type
DEFINE_RTTI_DATA1( bad_cast, 0, &exception_rtti_base_descriptor, ".?AVbad_cast@@" )
DEFINE_RTTI_DATA2( __non_rtti_object, 0, &bad_typeid_rtti_base_descriptor, &exception_rtti_base_descriptor, ".?AV__non_rtti_object@@" )
#endif
#if _MSVCR_VER >= 100
DEFINE_RTTI_DATA1(improper_scheduler_detach, 0, &exception_rtti_base_descriptor,
".?AVimproper_scheduler_detach@Concurrency@@" )
#endif
DEFINE_CXX_EXCEPTION0( exception, exception_dtor )
DEFINE_CXX_DATA1( bad_typeid, &exception_cxx_type_info, bad_typeid_dtor )
......@@ -634,9 +591,6 @@ DEFINE_CXX_DATA2( __non_rtti_object, &bad_typeid_cxx_type_info,
#if _MSVCR_VER >= 80
DEFINE_CXX_DATA1( bad_alloc, &exception_cxx_type_info, bad_alloc_dtor )
#endif
#if _MSVCR_VER >= 100
DEFINE_CXX_DATA1(improper_scheduler_detach, &exception_cxx_type_info, exception_dtor)
#endif
void msvcrt_init_exception(void *base)
{
......@@ -650,9 +604,6 @@ void msvcrt_init_exception(void *base)
init_bad_typeid_rtti(base);
init_bad_cast_rtti(base);
init___non_rtti_object_rtti(base);
#if _MSVCR_VER >= 100
init_improper_scheduler_detach_rtti(base);
#endif
init_exception_cxx(base);
init_bad_typeid_cxx(base);
......@@ -661,9 +612,6 @@ void msvcrt_init_exception(void *base)
#if _MSVCR_VER >= 80
init_bad_alloc_cxx(base);
#endif
#if _MSVCR_VER >= 100
init_improper_scheduler_detach_cxx(base);
#endif
#endif
}
......@@ -676,13 +624,6 @@ void throw_exception(exception_type et, HRESULT hr, const char *str)
__exception_ctor(&e, str, &bad_alloc_vtable);
_CxxThrowException(&e, &bad_alloc_exception_type);
}
#if _MSVCR_VER >= 100
case EXCEPTION_IMPROPER_SCHEDULER_DETACH: {
improper_scheduler_detach e;
improper_scheduler_detach_ctor_str(&e, str);
_CxxThrowException(&e, &improper_scheduler_detach_exception_type);
}
#endif
}
}
#endif
......
......@@ -189,9 +189,6 @@ void msvcrt_set_errno(int) DECLSPEC_HIDDEN;
#if _MSVCR_VER >= 80
typedef enum {
EXCEPTION_BAD_ALLOC,
#if _MSVCR_VER >= 100
EXCEPTION_IMPROPER_SCHEDULER_DETACH,
#endif
} exception_type;
void throw_exception(exception_type, HRESULT, const char*) DECLSPEC_HIDDEN;
#endif
......
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