[corlib] Fixes security tests failures
[mono.git] / mcs / class / corlib / System.Threading / AsyncFlowControl.cs
index 37f355e73039010dabe23be592b8bc879dd99ccf..43aee69d6f590bcb1664535006661d0b05e053dc 100644 (file)
@@ -1,5 +1,5 @@
 //
-// System.Threading.AsyncFlowControl structure
+// System.Threading.AsyncFlowControl.cs
 //
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.com>
@@ -38,11 +38,7 @@ namespace System.Threading {
                Security
        }
 
-#if NET_2_0
        public struct AsyncFlowControl : IDisposable {
-#else
-       internal struct AsyncFlowControl : IDisposable {
-#endif
                private Thread _t;
                private AsyncFlowControlType _type;
 
@@ -69,7 +65,7 @@ namespace System.Threading {
                        _t = null;
                }
 
-               void IDisposable.Dispose () 
+               public void Dispose ()
                {
                        if (_t != null) {
                                Undo ();
@@ -77,5 +73,39 @@ namespace System.Threading {
                                _type = AsyncFlowControlType.None;
                        }
                }
+
+               public override int GetHashCode ()
+               {
+                       return(base.GetHashCode ());
+               }
+               
+               public override bool Equals (object obj)
+               {
+                       if (!(obj is AsyncFlowControl)) {
+                               return(false);
+                       }
+                       
+                       return(obj.Equals (this));
+               }
+               
+               public bool Equals (AsyncFlowControl obj)
+               {
+                       if (this._t == obj._t &&
+                           this._type == obj._type) {
+                               return(true);
+                       } else {
+                               return(false);
+                       }
+               }
+
+               public static bool operator == (AsyncFlowControl a, AsyncFlowControl b)
+               {
+                       return a.Equals (b);
+               }
+
+               public static bool operator != (AsyncFlowControl a, AsyncFlowControl b)
+               {
+                       return !a.Equals (b);
+               }
        }
 }