public void Dispose() { if (_disposed) { return; } SetHandle(NativeMethods.JobObjectLimitFlags.JOB_NONE); _handle.Close(); _handle.Dispose(); _handle = null; _disposed = true; }
public void Dispose() { if (m_disposed) { return; } try { if (Common.IsPosixEnvironment) { foreach (WeakReference <Process> childProcessReference in m_childProcesses) { Process childProcess; if (!childProcessReference.TryGetTarget(out childProcess)) { continue; } try { childProcess.Kill(); } catch (Exception ex) { TerminationException?.Invoke(this, new EventArgs <Exception>(ex)); } } } m_jobHandle?.Dispose(); m_jobHandle = null; } finally { m_disposed = true; GC.SuppressFinalize(this); } }
public void Dispose() => handle.Dispose();