[corlib] Re-introduce Thread.Abort/Suspend/Resume, but make them throw NotSupportedEx...
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 24 Nov 2015 18:49:27 +0000 (19:49 +0100)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Wed, 25 Nov 2015 11:55:13 +0000 (12:55 +0100)
Re-introduce Thread.Abort/Suspend/Resume so that we don't have to
create separate PCL profiles.

Instead make them throw a NotSupportedException, and add an
[Obsolete (error: true)] attribute so that these methods can't
be used from source.

mcs/class/corlib/System.Threading/Thread.cs

index a2e3f5b685de58f6e2dec02ebb8b92511d5907b2..6342136b37bd0b78e49aa650285442b84b4f0fc0 100644 (file)
@@ -489,6 +489,24 @@ namespace System.Threading {
                void ClearAbortReason ()
                {
                }
+#else
+               [Obsolete ("Thread.Abort is not supported on the current platform.", true)]
+               public void Abort ()
+               {
+                       throw new NotSupportedException ("Thread.Abort is not supported on the current platform.");
+               }
+
+               [Obsolete ("Thread.Abort is not supported on the current platform.", true)]
+               public void Abort (object stateInfo)
+               {
+                       throw new NotSupportedException ("Thread.Abort is not supported on the current platform.");
+               }
+
+               [Obsolete ("Thread.ResetAbort is not supported on the current platform.", true)]
+               public static void ResetAbort ()
+               {
+                       throw new NotSupportedException ("Thread.ResetAbort is not supported on the current platform.");
+               }
 #endif // MONO_FEATURE_THREAD_ABORT
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
@@ -724,5 +742,19 @@ namespace System.Threading {
                                res [threads [i]] = new StackTrace ((StackFrame[])stack_frames [i]);
                        return res;
                }
+
+#if !MONO_FEATURE_THREAD_SUSPEND_RESUME
+               [Obsolete ("Thread.Suspend is not supported on the current platform.", true)]
+               public void Suspend ()
+               {
+                       throw new NotSupportedException ("Thread.Suspend is not supported on the current platform.");
+               }
+
+               [Obsolete ("Thread.Resume is not supported on the current platform.", true)]
+               public void Resume ()
+               {
+                       throw new NotSupportedException ("Thread.Resume is not supported on the current platform.");
+               }
+#endif
        }
 }