[corlib] Fixes security tests failures
[mono.git] / mcs / class / corlib / System.Threading / AsyncFlowControl.cs
index 82b37f3170d68c9814bfc43080757c43c7ff23af..43aee69d6f590bcb1664535006661d0b05e053dc 100644 (file)
@@ -1,5 +1,5 @@
 //
-// System.Threading.AsyncFlowControl structure
+// System.Threading.AsyncFlowControl.cs
 //
 // Author:
 //     Sebastien Pouliot  <sebastien@ximian.com>
@@ -26,8 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
-
 using System.Globalization;
 using System.Runtime.InteropServices;
 using System.Security;
@@ -41,7 +39,6 @@ namespace System.Threading {
        }
 
        public struct AsyncFlowControl : IDisposable {
-
                private Thread _t;
                private AsyncFlowControlType _type;
 
@@ -68,7 +65,7 @@ namespace System.Threading {
                        _t = null;
                }
 
-               void IDisposable.Dispose () 
+               public void Dispose ()
                {
                        if (_t != null) {
                                Undo ();
@@ -76,7 +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);
+               }
        }
 }
-
-#endif