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();
     }
 }
예제 #3
0
 public void Dispose()
 {
     if (!m_Handle.IsValid())
     {
         return;
     }
     m_Handle.Dispose();
 }
 public void DisposeReadHandle()
 {
     if (_haveReadHandle)
     {
         _readHandle.Dispose();
         _haveReadHandle = false;
     }
 }
예제 #5
0
 public unsafe void Update()
 {
     if (!readHandle.IsValid() || readHandle.Status == ReadStatus.InProgress)
     {
         return;
     }
     readHandle.Dispose();
     UnsafeUtility.Free(cmd[0].Buffer, Allocator.Persistent);
     cmd.Dispose();
 }
예제 #6
0
        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;
            }
        }
예제 #7
0
        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);
        }
예제 #8
0
 private unsafe void Dispose()
 {
     _readHandle.Dispose();
     UnsafeUtility.Free(_readCommands[0].Buffer, Allocator.Persistent);
     _readCommands.Dispose();
 }
예제 #9
0
 public void ReadClose()
 {
     ReadHandle?.Dispose();
 }