[+] Catch around all async DispatchFrames. Will add optional forced panic later.
[*] Fix thread handle bug on non-au threads
This commit is contained in:
parent
278a128834
commit
48a8e4ae5a
@ -236,13 +236,22 @@ namespace Aurora::Async
|
||||
|
||||
void WorkItem::RunAsyncLocked()
|
||||
{
|
||||
|
||||
IWorkItemHandler::ProcessInfo info(true);
|
||||
info.pool = this->owner_->ToThreadPool();
|
||||
|
||||
if (this->task_)
|
||||
{
|
||||
this->task_->DispatchFrame(info);
|
||||
try
|
||||
{
|
||||
this->task_->DispatchFrame(info);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// TODO: runtime config for root level exception caught behaviour
|
||||
SysPushErrorCatch();
|
||||
Fail();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (info.type)
|
||||
|
@ -89,7 +89,6 @@ namespace Aurora::Threading::Threads
|
||||
this->bNotOwned = true;
|
||||
}
|
||||
|
||||
|
||||
bool DeadTest();
|
||||
|
||||
OSThread::~OSThread()
|
||||
@ -99,6 +98,10 @@ namespace Aurora::Threading::Threads
|
||||
|
||||
if (this->bNotOwned)
|
||||
{
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
auto hHandle = (HANDLE)this->handle_;
|
||||
AuWin32CloseHandle(hHandle);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@ -352,6 +355,7 @@ namespace Aurora::Threading::Threads
|
||||
void OSThread::SetName(const AuString &name)
|
||||
{
|
||||
this->name_ = name;
|
||||
this->UpdateName();
|
||||
}
|
||||
|
||||
EThreadThrottle OSThread::GetThrottle()
|
||||
@ -430,8 +434,14 @@ namespace Aurora::Threading::Threads
|
||||
{
|
||||
this->task_ = task;
|
||||
|
||||
this->handle_ = 0;
|
||||
|
||||
auto ret = SpawnThread([this]()
|
||||
{
|
||||
while (!this->handle_)
|
||||
{
|
||||
};
|
||||
|
||||
this->_ThreadEP();
|
||||
}, GetName(), this->info_.stackSize);
|
||||
|
||||
|
@ -42,9 +42,9 @@ namespace Aurora::Threading::Threads
|
||||
|
||||
HANDLE ret;
|
||||
auto process = GetCurrentProcess();
|
||||
auto thread = GetCurrentProcess();
|
||||
auto thread = GetCurrentThread();
|
||||
|
||||
if (!DuplicateHandle(process, thread, process, &ret, DUPLICATE_SAME_ACCESS, FALSE, DUPLICATE_SAME_ACCESS))
|
||||
if (!DuplicateHandle(process, thread, process, &ret, THREAD_ALL_ACCESS, FALSE, FALSE))
|
||||
{
|
||||
return reinterpret_cast<AuUInt64>(INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user