[System] Tweak tests to work with Thread.Interrupt as well.
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Fri, 20 Nov 2015 15:56:25 +0000 (16:56 +0100)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Wed, 25 Nov 2015 11:54:44 +0000 (12:54 +0100)
mcs/class/System/Test/System.Net/SocketResponder.cs

index 213f0b72d3fd1d4dca44d580f64ce9ce0bb05b1e..af05477fb6bee65d47eff4747392d2376ce00057 100644 (file)
@@ -137,6 +137,10 @@ namespace MonoTests.System.Net
                                        Console.WriteLine (ex);
                                        if (_state != STATE_STOPPED)
                                                throw;
+#if !MONO_FEATURE_THREAD_ABORT
+                               } catch (ThreadInterruptedException) {
+                                       break;
+#endif
 #if MOBILE
                                } catch (InvalidOperationException ex) {
                                        // This breaks some tests running on Android. The problem is that the stack trace
@@ -146,7 +150,15 @@ namespace MonoTests.System.Net
                                        Console.WriteLine (ex);
 #endif
                                } finally {
+#if MONO_FEATURE_THREAD_ABORT
                                        Thread.Sleep (500);
+#else
+                                       try {
+                                               Thread.Sleep (500);
+                                       } catch (ThreadInterruptedException) {
+                                               // nothing to do
+                                       }
+#endif
                                        if (listenSocket != null)
                                                listenSocket.Close ();
                                }