From 50791d90f42615d3ddd2251c08e25daaab9acce6 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 24 Nov 2015 19:49:27 +0100 Subject: [PATCH 1/1] [corlib] Re-introduce Thread.Abort/Suspend/Resume, but make them throw NotSupportedException instead. 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 | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs index a2e3f5b685d..6342136b37b 100644 --- a/mcs/class/corlib/System.Threading/Thread.cs +++ b/mcs/class/corlib/System.Threading/Thread.cs @@ -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 } } -- 2.25.1