public void Dispose() { Disposed = true; GC.SuppressFinalize(this); if (_readHandle != null) { _readHandle.Close(); } _handle.Close(); if (_nativeOverlapped != null) { Marshal.FreeHGlobal((IntPtr)_nativeOverlapped); _nativeOverlapped = null; } if (_segments != null) { Marshal.FreeHGlobal((IntPtr)_segments); _segments = null; } if (_manualResetEvent != null) { _manualResetEvent.Dispose(); } if (DeleteOnClose) { File.Delete(_filename); } }
public void Dispose() { Disposed = true; GC.SuppressFinalize(this); if (_readHandle != null) { _readHandle.Close(); } _handle.Close(); if (_nativeOverlapped != null) { Marshal.FreeHGlobal((IntPtr)_nativeOverlapped); _nativeOverlapped = null; } if (_segments != null) { Marshal.FreeHGlobal((IntPtr)_segments); _segments = null; } if (DeleteOnClose) { try { File.Delete(_filename); } catch (Exception) { // if we can't delete, nothing that we can do here. } } }
private void EnsureSegmentsSize(byte *[] pages) { if (_segmentsSize >= pages.Length + 1) { return; } _segmentsSize = (int)Utils.NearestPowerOfTwo(pages.Length + 1); if (_segments != null) { Marshal.FreeHGlobal((IntPtr)_segments); } _segments = (FileSegmentElement *)(Marshal.AllocHGlobal(_segmentsSize * sizeof(FileSegmentElement))); }
public void Dispose() { Disposed = true; GC.SuppressFinalize(this); if (_readHandle != null) _readHandle.Close(); _handle.Close(); if (_nativeOverlapped != null) { Marshal.FreeHGlobal((IntPtr) _nativeOverlapped); _nativeOverlapped = null; } if (_segments != null) { Marshal.FreeHGlobal((IntPtr) _segments); _segments = null; } if (DeleteOnClose) { try { File.Delete(_filename); } catch (Exception) { // if we can't delete, nothing that we can do here. } } }
private void EnsureSegmentsSize(IntPtr[] pages) { if (_segmentsSize >= pages.Length + 1) return; _segmentsSize = (int) Utils.NearestPowerOfTwo(pages.Length + 1); if (_segments != null) Marshal.FreeHGlobal((IntPtr) _segments); _segments = (FileSegmentElement*) (Marshal.AllocHGlobal(_segmentsSize*sizeof (FileSegmentElement))); }
private static extern bool WriteFileGather( SafeFileHandle hFile, FileSegmentElement *aSegmentArray, uint nNumberOfBytesToWrite, IntPtr lpReserved, NativeOverlapped *lpOverlapped);
public void Dispose() { Disposed = true; GC.SuppressFinalize(this); if (_readHandle != null) _readHandle.Close(); _handle.Close(); if (_nativeOverlapped != null) { Marshal.FreeHGlobal((IntPtr) _nativeOverlapped); _nativeOverlapped = null; } if (_segments != null) { Marshal.FreeHGlobal((IntPtr) _segments); _segments = null; } if (DeleteOnClose) { File.Delete(_filename); } }