示例#1
0
 protected override void Dispose(bool disposing)
 {
     lock (this)
     {
         if (disposing)
         {
             if (!IsOpen)
             {
                 // allow double close - usually to be consistent with other closeables
                 return; // already closed
             }
             IsOpen = false;
             if (writer != null)
             {
                 if (Debugging.AssertsEnabled)
                 {
                     Debugging.Assert(openForWrite);
                 }
                 writer.Dispose();
             }
             else
             {
                 IOUtils.Dispose(handle);
             }
         }
     }
 }
示例#2
0
 public override void Dispose()
 {
     lock (this)
     {
         if (!IsOpen)
         {
             // allow double close - usually to be consistent with other closeables
             return; // already closed
         }
         isOpen = false;
         if (Writer != null)
         {
             Debug.Assert(OpenForWrite);
             Writer.Dispose();
         }
         else
         {
             IOUtils.Close(Handle);
         }
     }
 }