public void Execute()
 {
     UnsafeUtility.Free(ptr, allocator);
     if (readHandle.IsValid())
     {
         readHandle.Dispose();
     }
 }
 public void Execute()
 {
     Memory.Unmanaged.Free(ptr, allocator);
     if (readHandle.IsValid())
     {
         readHandle.Dispose();
     }
 }
Esempio n. 3
0
 public void Dispose()
 {
     if (!m_Handle.IsValid())
     {
         return;
     }
     m_Handle.Dispose();
 }
 public void DisposeReadHandle()
 {
     if (_haveReadHandle)
     {
         _readHandle.Dispose();
         _haveReadHandle = false;
     }
 }
 public unsafe void Update()
 {
     if (!readHandle.IsValid() || readHandle.Status == ReadStatus.InProgress)
     {
         return;
     }
     readHandle.Dispose();
     UnsafeUtility.Free(cmd[0].Buffer, Allocator.Persistent);
     cmd.Dispose();
 }
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    DisposeTokenSource?.Cancel();
                    DisposeTokenSource?.Dispose();

                    ReadHandle?.Dispose();
                    WriteHandle?.Dispose();
                }

                disposedValue = true;
            }
        }
        public bool ReadOpen()
        {
            bool result = false;

            if (!IsReadOpened)
            {
                try
                {
                    ReadHandle.Dispose();
                    ReadHandle = Helper.OpenDevice(DeviceInfo.DevicePath, DesiredAccesses.GenericRead,
                                                   ShareModes.FileShareRead | ShareModes.FileShareWrite, FileFlags.FileFlagOverlapped);
                    result = IsReadOpened;
                }
                catch (Exception e)
                {
                    throw new DeviceCouldNotOpenedException($"This device could not {nameof(ReadOpen)}. Please check inner exception ({e.GetType()})", e);
                }
            }

            return(result);
        }
Esempio n. 8
0
 private unsafe void Dispose()
 {
     _readHandle.Dispose();
     UnsafeUtility.Free(_readCommands[0].Buffer, Allocator.Persistent);
     _readCommands.Dispose();
 }
 public void ReadClose()
 {
     ReadHandle?.Dispose();
 }