public void Dispose() { NativeJob.CloseHandle(_hJob); foreach (Process process in _processes) { process.Dispose(); } GC.SuppressFinalize(this); _hJob = IntPtr.Zero; }
protected virtual void Dispose(bool disposing) { if (!Disposed) { if (disposing) { foreach (Process process in _processes) { process.Dispose(); } } NativeJob.CloseHandle(_hJob); Disposed = true; } }
public void Dispose(bool disposing) { if (_hJob == IntPtr.Zero) { return; } if (disposing) { ReleaseManaged(); GC.SuppressFinalize(this); } NativeJob.CloseHandle(_hJob); _hJob = IntPtr.Zero; }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { foreach (var process in _processes) { process.Dispose(); } } NativeJob.CloseHandle(_hJob); _disposed = true; }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { foreach (var process in _processes) { process.Dispose(); } _processes = null; } NativeJob.CloseHandle(_hJob); GC.RemoveMemoryPressure(_sizeInByte); _disposed = true; }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { foreach (var process in _processes) { process.Dispose(); } } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. NativeJob.CloseHandle(_hJob); disposedValue = true; } }
private void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { foreach (Process p in _processes) { p.Dispose(); } _processes = null; } NativeJob.CloseHandle(_hJob); if (_size > 0) { GC.RemoveMemoryPressure(_size); _disposed = true; } }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { foreach (var proc in _processes) { proc.Dispose(); } } NativeJob.CloseHandle(_hJob); if (_sizeInByte > 0) { GC.RemoveMemoryPressure(_sizeInByte); } Console.WriteLine("Job was released"); _disposed = true; }
private void Close() { NativeJob.CloseHandle(_hJob); _hJob = IntPtr.Zero; }
private void FreeResource() { NativeJob.CloseHandle(_hJob); _hJob = IntPtr.Zero; }