diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2016-12-27 16:46:08 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2016-12-27 16:46:08 +0900 |
commit | db20f3f1bb8595633a7e16c8900fd401a453a6b5 (patch) | |
tree | e5435159cd1bf0519276363a6fe1663d1721bed3 /src/mscorlib/src/System/Threading/Monitor.cs | |
parent | 4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (diff) | |
download | coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.gz coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.bz2 coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.zip |
Imported Upstream version 1.0.0.9127upstream/1.0.0.9127
Diffstat (limited to 'src/mscorlib/src/System/Threading/Monitor.cs')
-rw-r--r-- | src/mscorlib/src/System/Threading/Monitor.cs | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/mscorlib/src/System/Threading/Monitor.cs b/src/mscorlib/src/System/Threading/Monitor.cs index 415948b425..94dec13d05 100644 --- a/src/mscorlib/src/System/Threading/Monitor.cs +++ b/src/mscorlib/src/System/Threading/Monitor.cs @@ -24,9 +24,9 @@ namespace System.Threading { using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; + using System.Diagnostics; using System.Diagnostics.Contracts; - [HostProtection(Synchronization=true, ExternalThreading=true)] [System.Runtime.InteropServices.ComVisible(true)] public static class Monitor { @@ -38,7 +38,6 @@ namespace System.Threading { ** ** Exceptions: ArgumentNullException if object is null. =========================================================================*/ - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void Enter(Object obj); @@ -54,7 +53,7 @@ namespace System.Threading { ThrowLockTakenException(); ReliableEnter(obj, ref lockTaken); - Contract.Assert(lockTaken); + Debug.Assert(lockTaken); } private static void ThrowLockTakenException() @@ -62,7 +61,6 @@ namespace System.Threading { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeFalse"), "lockTaken"); } - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ReliableEnter(Object obj, ref bool lockTaken); @@ -77,7 +75,6 @@ namespace System.Threading { ** SynchronizationLockException if the current thread does not ** own the lock. =========================================================================*/ - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern void Exit(Object obj); @@ -127,7 +124,7 @@ namespace System.Threading { { long tm = (long)timeout.TotalMilliseconds; if (tm < -1 || tm > (long)Int32.MaxValue) - throw new ArgumentOutOfRangeException("timeout", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1")); + throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1")); return (int)tm; } @@ -154,20 +151,17 @@ namespace System.Threading { ReliableEnterTimeout(obj, MillisecondsTimeoutFromTimeSpan(timeout), ref lockTaken); } - [System.Security.SecuritySafeCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ReliableEnterTimeout(Object obj, int timeout, ref bool lockTaken); - [System.Security.SecuritySafeCritical] public static bool IsEntered(object obj) { if (obj == null) - throw new ArgumentNullException("obj"); + throw new ArgumentNullException(nameof(obj)); return IsEnteredNative(obj); } - [System.Security.SecurityCritical] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool IsEnteredNative(Object obj); @@ -182,15 +176,13 @@ namespace System.Threading { ** ** Exceptions: ArgumentNullException if object is null. ========================================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool ObjWait(bool exitContext, int millisecondsTimeout, Object obj); - [System.Security.SecuritySafeCritical] // auto-generated public static bool Wait(Object obj, int millisecondsTimeout, bool exitContext) { if (obj == null) - throw (new ArgumentNullException("obj")); + throw (new ArgumentNullException(nameof(obj))); return ObjWait(exitContext, millisecondsTimeout, obj); } @@ -219,16 +211,14 @@ namespace System.Threading { * Exceptions: SynchronizationLockException if this method is not called inside * a synchronized block of code. ========================================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ObjPulse(Object obj); - [System.Security.SecuritySafeCritical] // auto-generated public static void Pulse(Object obj) { if (obj == null) { - throw new ArgumentNullException("obj"); + throw new ArgumentNullException(nameof(obj)); } Contract.EndContractBlock(); @@ -237,16 +227,14 @@ namespace System.Threading { /*======================================================================== ** Sends a notification to all waiting objects. ========================================================================*/ - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void ObjPulseAll(Object obj); - [System.Security.SecuritySafeCritical] // auto-generated public static void PulseAll(Object obj) { if (obj == null) { - throw new ArgumentNullException("obj"); + throw new ArgumentNullException(nameof(obj)); } Contract.EndContractBlock(); |