msvcrt: Move scheduler_resource_allocation_error to concurrency.c.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2021-08-20 18:44:46 +02:00 committed by Alexandre Julliard
parent ef81cfb5fb
commit a8decf5c15
3 changed files with 63 additions and 68 deletions

View File

@ -302,6 +302,12 @@ typedef struct {
typedef exception improper_lock;
extern const vtable_ptr improper_lock_vtable;
typedef struct {
exception e;
HRESULT hr;
} scheduler_resource_allocation_error;
extern const vtable_ptr scheduler_resource_allocation_error_vtable;
enum ConcRT_EventType
{
CONCRT_EVENT_GENERIC,
@ -355,15 +361,66 @@ improper_lock * __thiscall improper_lock_copy_ctor(improper_lock *this, const im
return __exception_copy_ctor(this, rhs, &improper_lock_vtable);
}
/* ??0scheduler_resource_allocation_error@Concurrency@@QAE@PBDJ@Z */
/* ??0scheduler_resource_allocation_error@Concurrency@@QEAA@PEBDJ@Z */
DEFINE_THISCALL_WRAPPER(scheduler_resource_allocation_error_ctor_name, 12)
scheduler_resource_allocation_error* __thiscall scheduler_resource_allocation_error_ctor_name(
scheduler_resource_allocation_error *this, const char *name, HRESULT hr)
{
TRACE("(%p %s %x)\n", this, wine_dbgstr_a(name), hr);
__exception_ctor(&this->e, name, &scheduler_resource_allocation_error_vtable);
this->hr = hr;
return this;
}
/* ??0scheduler_resource_allocation_error@Concurrency@@QAE@J@Z */
/* ??0scheduler_resource_allocation_error@Concurrency@@QEAA@J@Z */
DEFINE_THISCALL_WRAPPER(scheduler_resource_allocation_error_ctor, 8)
scheduler_resource_allocation_error* __thiscall scheduler_resource_allocation_error_ctor(
scheduler_resource_allocation_error *this, HRESULT hr)
{
return scheduler_resource_allocation_error_ctor_name(this, NULL, hr);
}
DEFINE_THISCALL_WRAPPER(scheduler_resource_allocation_error_copy_ctor,8)
scheduler_resource_allocation_error* __thiscall scheduler_resource_allocation_error_copy_ctor(
scheduler_resource_allocation_error *this,
const scheduler_resource_allocation_error *rhs)
{
TRACE("(%p,%p)\n", this, rhs);
if (!rhs->e.do_free)
memcpy(this, rhs, sizeof(*this));
else
scheduler_resource_allocation_error_ctor_name(this, rhs->e.name, rhs->hr);
return this;
}
/* ?get_error_code@scheduler_resource_allocation_error@Concurrency@@QBEJXZ */
/* ?get_error_code@scheduler_resource_allocation_error@Concurrency@@QEBAJXZ */
DEFINE_THISCALL_WRAPPER(scheduler_resource_allocation_error_get_error_code, 4)
HRESULT __thiscall scheduler_resource_allocation_error_get_error_code(
const scheduler_resource_allocation_error *this)
{
TRACE("(%p)\n", this);
return this->hr;
}
DEFINE_RTTI_DATA1(improper_lock, 0, &cexception_rtti_base_descriptor,
".?AVimproper_lock@Concurrency@@")
DEFINE_RTTI_DATA1(scheduler_resource_allocation_error, 0, &cexception_rtti_base_descriptor,
".?AVscheduler_resource_allocation_error@Concurrency@@")
DEFINE_CXX_DATA1(improper_lock, &cexception_cxx_type_info, cexception_dtor)
DEFINE_CXX_DATA1(scheduler_resource_allocation_error, &cexception_cxx_type_info, cexception_dtor)
__ASM_BLOCK_BEGIN(concurrency_exception_vtables)
__ASM_VTABLE(improper_lock,
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what));
__ASM_VTABLE(scheduler_resource_allocation_error,
VTABLE_ADD_FUNC(cexception_vector_dtor)
VTABLE_ADD_FUNC(cexception_what));
__ASM_BLOCK_END
static Context* try_get_current_context(void)
@ -380,9 +437,10 @@ static Context* get_current_context(void)
if (context_tls_index == TLS_OUT_OF_INDEXES) {
int tls_index = TlsAlloc();
if (tls_index == TLS_OUT_OF_INDEXES) {
throw_exception(EXCEPTION_SCHEDULER_RESOURCE_ALLOCATION_ERROR,
HRESULT_FROM_WIN32(GetLastError()), NULL);
return NULL;
scheduler_resource_allocation_error e;
scheduler_resource_allocation_error_ctor_name(&e, NULL,
HRESULT_FROM_WIN32(GetLastError()));
_CxxThrowException(&e.e, &scheduler_resource_allocation_error_exception_type);
}
if(InterlockedCompareExchange(&context_tls_index, tls_index, TLS_OUT_OF_INDEXES) != TLS_OUT_OF_INDEXES)
@ -2525,6 +2583,7 @@ void msvcrt_init_concurrency(void *base)
#ifdef __x86_64__
init_cexception_rtti(base);
init_improper_lock_rtti(base);
init_scheduler_resource_allocation_error_rtti(base);
init_Context_rtti(base);
init_ContextBase_rtti(base);
init_ExternalContextBase_rtti(base);
@ -2534,6 +2593,7 @@ void msvcrt_init_concurrency(void *base)
init_cexception_cxx_type_info(base);
init_improper_lock_cxx(base);
init_scheduler_resource_allocation_error_cxx(base);
#endif
}

View File

@ -551,57 +551,6 @@ void __thiscall bad_alloc_dtor(bad_alloc * _this)
#if _MSVCR_VER >= 100
typedef struct {
exception e;
HRESULT hr;
} scheduler_resource_allocation_error;
extern const vtable_ptr scheduler_resource_allocation_error_vtable;
/* ??0scheduler_resource_allocation_error@Concurrency@@QAE@PBDJ@Z */
/* ??0scheduler_resource_allocation_error@Concurrency@@QEAA@PEBDJ@Z */
DEFINE_THISCALL_WRAPPER(scheduler_resource_allocation_error_ctor_name, 12)
scheduler_resource_allocation_error* __thiscall scheduler_resource_allocation_error_ctor_name(
scheduler_resource_allocation_error *this, const char *name, HRESULT hr)
{
TRACE("(%p %s %x)\n", this, wine_dbgstr_a(name), hr);
__exception_ctor(&this->e, name, &scheduler_resource_allocation_error_vtable);
this->hr = hr;
return this;
}
/* ??0scheduler_resource_allocation_error@Concurrency@@QAE@J@Z */
/* ??0scheduler_resource_allocation_error@Concurrency@@QEAA@J@Z */
DEFINE_THISCALL_WRAPPER(scheduler_resource_allocation_error_ctor, 8)
scheduler_resource_allocation_error* __thiscall scheduler_resource_allocation_error_ctor(
scheduler_resource_allocation_error *this, HRESULT hr)
{
return scheduler_resource_allocation_error_ctor_name(this, NULL, hr);
}
DEFINE_THISCALL_WRAPPER(scheduler_resource_allocation_error_copy_ctor,8)
scheduler_resource_allocation_error* __thiscall scheduler_resource_allocation_error_copy_ctor(
scheduler_resource_allocation_error *this,
const scheduler_resource_allocation_error *rhs)
{
TRACE("(%p,%p)\n", this, rhs);
if (!rhs->e.do_free)
memcpy(this, rhs, sizeof(*this));
else
scheduler_resource_allocation_error_ctor_name(this, rhs->e.name, rhs->hr);
return this;
}
/* ?get_error_code@scheduler_resource_allocation_error@Concurrency@@QBEJXZ */
/* ?get_error_code@scheduler_resource_allocation_error@Concurrency@@QEBAJXZ */
DEFINE_THISCALL_WRAPPER(scheduler_resource_allocation_error_get_error_code, 4)
HRESULT __thiscall scheduler_resource_allocation_error_get_error_code(
const scheduler_resource_allocation_error *this)
{
TRACE("(%p)\n", this);
return this->hr;
}
typedef exception invalid_scheduler_policy_key;
extern const vtable_ptr invalid_scheduler_policy_key_vtable;
@ -774,9 +723,6 @@ __ASM_VTABLE(__non_rtti_object,
VTABLE_ADD_FUNC(__non_rtti_object_vector_dtor)
VTABLE_ADD_FUNC(exception_what));
#if _MSVCR_VER >= 100
__ASM_VTABLE(scheduler_resource_allocation_error,
VTABLE_ADD_FUNC(exception_vector_dtor)
VTABLE_ADD_FUNC(exception_what));
__ASM_VTABLE(invalid_scheduler_policy_key,
VTABLE_ADD_FUNC(exception_vector_dtor)
VTABLE_ADD_FUNC(exception_what));
@ -808,8 +754,6 @@ 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(scheduler_resource_allocation_error, 0, &exception_rtti_base_descriptor,
".?AVscheduler_resource_allocation_error@Concurrency@@")
DEFINE_RTTI_DATA1(invalid_scheduler_policy_key, 0, &exception_rtti_base_descriptor,
".?AVinvalid_scheduler_policy_key@Concurrency@@" )
DEFINE_RTTI_DATA1(invalid_scheduler_policy_value, 0, &exception_rtti_base_descriptor,
@ -831,7 +775,6 @@ DEFINE_CXX_DATA2( __non_rtti_object, &bad_typeid_cxx_type_info,
DEFINE_CXX_DATA1( bad_alloc, &exception_cxx_type_info, bad_alloc_dtor )
#endif
#if _MSVCR_VER >= 100
DEFINE_CXX_DATA1(scheduler_resource_allocation_error, &exception_cxx_type_info, exception_dtor)
DEFINE_CXX_DATA1(invalid_scheduler_policy_key, &exception_cxx_type_info, exception_dtor)
DEFINE_CXX_DATA1(invalid_scheduler_policy_value, &exception_cxx_type_info, exception_dtor)
DEFINE_CXX_DATA1(invalid_scheduler_policy_thread_specification, &exception_cxx_type_info, exception_dtor)
@ -852,7 +795,6 @@ void msvcrt_init_exception(void *base)
init_bad_cast_rtti(base);
init___non_rtti_object_rtti(base);
#if _MSVCR_VER >= 100
init_scheduler_resource_allocation_error_rtti(base);
init_invalid_scheduler_policy_key_rtti(base);
init_invalid_scheduler_policy_value_rtti(base);
init_invalid_scheduler_policy_thread_specification_rtti(base);
@ -868,7 +810,6 @@ void msvcrt_init_exception(void *base)
init_bad_alloc_cxx(base);
#endif
#if _MSVCR_VER >= 100
init_scheduler_resource_allocation_error_cxx(base);
init_invalid_scheduler_policy_key_cxx(base);
init_invalid_scheduler_policy_value_cxx(base);
init_invalid_scheduler_policy_thread_specification_cxx(base);
@ -888,11 +829,6 @@ void throw_exception(exception_type et, HRESULT hr, const char *str)
_CxxThrowException(&e, &bad_alloc_exception_type);
}
#if _MSVCR_VER >= 100
case EXCEPTION_SCHEDULER_RESOURCE_ALLOCATION_ERROR: {
scheduler_resource_allocation_error e;
scheduler_resource_allocation_error_ctor_name(&e, str, hr);
_CxxThrowException(&e.e, &scheduler_resource_allocation_error_exception_type);
}
case EXCEPTION_INVALID_SCHEDULER_POLICY_KEY: {
invalid_scheduler_policy_key e;
invalid_scheduler_policy_key_ctor_str(&e, str);

View File

@ -190,7 +190,6 @@ void msvcrt_set_errno(int) DECLSPEC_HIDDEN;
typedef enum {
EXCEPTION_BAD_ALLOC,
#if _MSVCR_VER >= 100
EXCEPTION_SCHEDULER_RESOURCE_ALLOCATION_ERROR,
EXCEPTION_INVALID_SCHEDULER_POLICY_KEY,
EXCEPTION_INVALID_SCHEDULER_POLICY_VALUE,
EXCEPTION_INVALID_SCHEDULER_POLICY_THREAD_SPECIFICATION,