Diff of /System.Data.SQLite/CriticalHandle.cs [000000] .. [8e2213] Maximize Restore

  Switch to side-by-side view

--- a
+++ b/System.Data.SQLite/CriticalHandle.cs
@@ -0,0 +1,74 @@
+ďťżnamespace System.Data.SQLite
+{
+#if PLATFORM_COMPACTFRAMEWORK
+    internal abstract class CriticalHandle : IDisposable
+    {
+        private bool _isClosed;
+        protected IntPtr handle;
+
+        protected CriticalHandle(IntPtr invalidHandleValue)
+        {
+            handle = invalidHandleValue;
+            _isClosed = false;
+        }
+
+        ~CriticalHandle()
+        {
+            Dispose(false);
+        }
+
+        private void Cleanup()
+        {
+            if (!IsClosed)
+            {
+                this._isClosed = true;
+                if (!IsInvalid)
+                {
+                    ReleaseHandle();
+                    GC.SuppressFinalize(this);
+                }
+            }
+        }
+
+        public void Close()
+        {
+            Dispose(true);
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            Cleanup();
+        }
+
+        protected abstract bool ReleaseHandle();
+
+        protected void SetHandle(IntPtr value)
+        {
+            handle = value;
+        }
+
+        public void SetHandleAsInvalid()
+        {
+            _isClosed = true;
+            GC.SuppressFinalize(this);
+        }
+
+        public bool IsClosed
+        {
+            get { return _isClosed; }
+        }
+
+        public abstract bool IsInvalid
+        {
+            get;
+        }
+
+    }
+
+#endif
+}