Moved TestConfiguration.cs to Npgsql.
[mono.git] / mcs / class / corlib / System.Runtime.InteropServices / CriticalHandle.cs
index ce99aa7d4466b82778b6f0f5fd46c13c23e6ac71..2f2574b3ae321057f4190fd732bc41c651038c5f 100644 (file)
@@ -1,71 +1,81 @@
-//\r
-// System.Runtime.InteropServices.CriticalHandle\r
-//\r
-// Author:\r
-//   Kazuki Oikawa  (kazuki@panicode.com)\r
-//\r
-\r
-#if NET_2_0\r
-\r
-using System;\r
-using System.Runtime.ConstrainedExecution;\r
-using System.Runtime.Serialization;\r
-\r
-namespace System.Runtime.InteropServices\r
-{\r
-       public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable\r
-       {\r
-               protected IntPtr handle;\r
-               bool _disposed = false;\r
-\r
-               protected CriticalHandle (IntPtr invalidHandleValue)\r
-               {\r
-                       handle = invalidHandleValue;\r
-               }\r
-\r
-               ~CriticalHandle ()\r
-               {\r
-                       Dispose ();\r
-               }\r
-\r
-               public void Close ()\r
-               {\r
-                       Dispose ();\r
-               }\r
-\r
-               public void Dispose ()\r
-               {\r
-                       if (_disposed)\r
-                               return;\r
-\r
-                       _disposed = true;\r
-                       if (IsInvalid)\r
-                               return;\r
-\r
-                       if (ReleaseHandle ()) {\r
-                               GC.SuppressFinalize (this);\r
-                       } else {\r
-                               // Failed in release...\r
-                       }\r
-               }\r
-\r
-               protected abstract bool ReleaseHandle ();\r
-\r
-               protected void SetHandle (IntPtr handle)\r
-               {\r
-                       this.handle = handle;\r
-               }\r
-\r
-               public void SetHandleAsInvalid()\r
-               {\r
-                       _disposed = true;\r
-               }\r
-\r
-               public bool IsClosed {\r
-                       get { return _disposed; }\r
-               }\r
-\r
-               public abstract bool IsInvalid {get;}\r
-       }\r
-}\r
-#endif
\ No newline at end of file
+//
+// System.Runtime.InteropServices.CriticalHandle
+//
+// Author:
+//   Kazuki Oikawa  (kazuki@panicode.com)
+//
+
+#if NET_2_0
+
+using System;
+using System.Runtime.ConstrainedExecution;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.InteropServices
+{
+       public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
+       {
+               protected IntPtr handle;
+               bool _disposed = false;
+
+               protected CriticalHandle (IntPtr invalidHandleValue)
+               {
+                       handle = invalidHandleValue;
+               }
+
+               [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+               ~CriticalHandle ()
+               {
+                       Dispose ();
+               }
+
+               [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+               public void Close ()
+               {
+                       Dispose ();
+               }
+
+               [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+               public void Dispose ()
+               {
+                       if (_disposed)
+                               return;
+
+                       _disposed = true;
+                       if (IsInvalid)
+                               return;
+
+                       if (ReleaseHandle ()) {
+                               GC.SuppressFinalize (this);
+                       } else {
+                               // Failed in release...
+                       }
+               }
+
+               [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+               protected abstract bool ReleaseHandle ();
+
+               [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+               protected void SetHandle (IntPtr handle)
+               {
+                       this.handle = handle;
+               }
+
+               [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+               public void SetHandleAsInvalid()
+               {
+                       _disposed = true;
+               }
+
+               public bool IsClosed {
+                       [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+                       get { return _disposed; }
+               }
+
+               public abstract bool IsInvalid {
+                       [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+                       get;
+               }
+       }
+}
+#endif