feat: catch exception for error in thread

develop
paring 2022-11-09 17:11:51 +09:00
parent 3c29035c02
commit 6a37539b37
Signed by: pikokr
GPG Key ID: DB839724AD14EC9F
1 changed files with 19 additions and 11 deletions

View File

@ -79,20 +79,28 @@ namespace SkyHook
new Thread(() => new Thread(() =>
{ {
if (isHookActive) return; try
var result = SkyHookNative.StartHook(HookCallback);
if (result != null)
{ {
exception = new SkyHookException(result); if (isHookActive) return;
var result = SkyHookNative.StartHook(HookCallback);
if (result != null)
{
exception = new SkyHookException(result);
}
isHookActive = true;
started = true;
while (isHookActive)
{
}
} }
catch (Exception e)
isHookActive = true;
started = true;
while (isHookActive)
{ {
exception = e;
throw;
} }
}).Start(); }).Start();