public async Task Tick(string DllPath) { await Task.Delay(3000); await Task.Run(() => threadi(DllPath)); while (true) { var context = new CONTEXT(); try { if (!Win32Apis.GetThreadContext(this.thread, ref context)) { mutex.Close(); return; } await Task.Delay(5000); } catch (Exception) { try { mutex.Close(); throw; } catch (Exception) { throw; } } } }
public static extern bool GetThreadContext(IntPtr hThread, ref CONTEXT lpContext);