[corlib] Fixes security tests failures
[mono.git] / mcs / class / corlib / System.Threading / WaitHandle.cs
index 44accfd38547ba89933eafba9a216617eea01908..5558efad52f46159fe85716d319e60902ec26eaa 100644 (file)
@@ -239,11 +239,7 @@ namespace System.Threading
                        Dispose(true);
                }
 
-#if NET_4_0
                public void Dispose ()
-#else          
-               void IDisposable.Dispose ()
-#endif
                {
                        Close ();
                }
@@ -371,17 +367,17 @@ namespace System.Threading
                        bool release = false;
                        try {
                                if (exitContext) {
-#if MONOTOUCH
-                                       throw new NotSupportedException ("exitContext == true is not supported");
-#else
+#if !MONOTOUCH
                                        SynchronizationAttribute.ExitContext ();
 #endif
                                }
                                safe_wait_handle.DangerousAddRef (ref release);
                                return (WaitOne_internal(safe_wait_handle.DangerousGetHandle (), millisecondsTimeout, exitContext));
                        } finally {
+#if !MONOTOUCH
                                if (exitContext)
                                        SynchronizationAttribute.EnterContext ();
+#endif
                                if (release)
                                        safe_wait_handle.DangerousRelease ();
                        }
@@ -407,9 +403,7 @@ namespace System.Threading
                        bool release = false;
                        try {
                                if (exitContext) {
-#if MONOTOUCH
-                                       throw new NotSupportedException ("exitContext == true is not supported");
-#else
+#if !MONOTOUCH
                                        SynchronizationAttribute.ExitContext ();
 #endif
                                }
@@ -417,8 +411,10 @@ namespace System.Threading
                                return (WaitOne_internal(safe_wait_handle.DangerousGetHandle (), (int) ms, exitContext));
                        }
                        finally {
+#if !MONOTOUCH
                                if (exitContext)
                                        SynchronizationAttribute.EnterContext ();
+#endif
                                if (release)
                                        safe_wait_handle.DangerousRelease ();
                        }