Keep only 1 Dispose implementation
[mono.git] / mcs / class / corlib / System.Threading / WaitHandle.cs
index ffd70ebe28b2b44ec2b48b7a1ca4dfde2fb29068..0c4daaf09ad5d71e60c3dca93d76f7f104140117 100644 (file)
@@ -54,6 +54,14 @@ namespace System.Threading
                        if (length > 64)
                                throw new NotSupportedException ("Too many handles");
 
+                       if (handles.Length == 0) {
+                               // MS throws different exceptions from the different methods.
+                               if (waitAll)
+                                       throw new ArgumentNullException ("waitHandles");
+                               else
+                                       throw new ArgumentException ();
+                       }
+
 #if false
                        //
                        // Although we should thrown an exception if this is an STA thread,
@@ -205,6 +213,15 @@ namespace System.Threading
                        GC.SuppressFinalize (this);
                }
 
+#if NET_4_0
+               public void Dispose ()
+#else          
+               void IDisposable.Dispose ()
+#endif
+               {
+                       Close ();
+               }
+
                public const int WaitTimeout = 258;
 
                //
@@ -387,12 +404,6 @@ namespace System.Threading
                protected static readonly IntPtr InvalidHandle = (IntPtr) (-1);
                bool disposed = false;
 
-               void IDisposable.Dispose() {
-                       Dispose(true);
-                       // Take yourself off the Finalization queue
-                       GC.SuppressFinalize(this);
-               }
-               
                ~WaitHandle() {
                        Dispose(false);
                }