diff options
author | Jan Kotas <jkotas@microsoft.com> | 2015-12-30 22:06:01 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2016-01-09 20:19:08 +0300 |
commit | 56dc78124e63b9c655f199defe3365d7f74c86dd (patch) | |
tree | 5ce3b1fde8a982e3c22e5fcd51fd86ead15e93be /src/System.Private.CoreLib | |
parent | 4c9971a522676030ebb593da44ac775639c0d7bf (diff) |
Remove CORERT TODOs from System.Monitor.Lock
Diffstat (limited to 'src/System.Private.CoreLib')
-rw-r--r-- | src/System.Private.CoreLib/src/System/Threading/Lock.cs | 10 | ||||
-rw-r--r-- | src/System.Private.CoreLib/src/System/Threading/Monitor.cs | 53 |
2 files changed, 11 insertions, 52 deletions
diff --git a/src/System.Private.CoreLib/src/System/Threading/Lock.cs b/src/System.Private.CoreLib/src/System/Threading/Lock.cs index 139c85513..2661b35cc 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Lock.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Lock.cs @@ -26,7 +26,15 @@ namespace System.Threading // overloads operator == to do the right thing, and b) Lock is sealed, so we // don't need to waste time traversing the inheritence heirarchy. // - internal static bool IsLock(object obj) { return obj.EETypePtr == typeof(Lock).TypeHandle.ToEETypePtr(); } + internal static bool IsLock(object obj) + { +#if CORERT + // CORERT-TODO + return obj is Lock; +#else + return obj.EETypePtr == typeof(Lock).TypeHandle.ToEETypePtr(); +#endif + } // // m_state layout: diff --git a/src/System.Private.CoreLib/src/System/Threading/Monitor.cs b/src/System.Private.CoreLib/src/System/Threading/Monitor.cs index 641e94cad..c10630101 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Monitor.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Monitor.cs @@ -60,27 +60,17 @@ namespace System.Threading public static void Enter(Object obj) { -#if CORERT - // CORERT-TODO locks - return; -#else Lock lck = GetLock(obj); if (lck.TryAcquire(0)) return; TryAcquireContended(lck, obj, Timeout.Infinite); - return; -#endif } public static void Enter(Object obj, ref bool lockTaken) { if (lockTaken) throw new ArgumentException(SR.Argument_MustBeFalse, "lockTaken"); -#if CORERT - // CORERT-TODO locks - lockTaken = true; - return; -#else + Lock lck = GetLock(obj); if (lck.TryAcquire(0)) { @@ -89,30 +79,19 @@ namespace System.Threading } TryAcquireContended(lck, obj, Timeout.Infinite); lockTaken = true; - return; -#endif } public static bool TryEnter(Object obj) { -#if CORERT - // CORERT-TODO locks - return true; -#else return GetLock(obj).TryAcquire(0); -#endif } public static void TryEnter(Object obj, ref bool lockTaken) { if (lockTaken) throw new ArgumentException(SR.Argument_MustBeFalse, "lockTaken"); -#if CORERT - // CORERT-TODO locks - lockTaken = true; -#else + lockTaken = GetLock(obj).TryAcquire(0); -#endif } public static bool TryEnter(Object obj, int millisecondsTimeout) @@ -120,15 +99,10 @@ namespace System.Threading if (millisecondsTimeout < -1) throw new ArgumentOutOfRangeException("millisecondsTimeout", SR.ArgumentOutOfRange_NeedNonNegOrNegative1); -#if CORERT - // CORERT-TODO locks - return true; -#else Lock lck = GetLock(obj); if (lck.TryAcquire(0)) return true; return TryAcquireContended(lck, obj, millisecondsTimeout); -#endif } public static void TryEnter(Object obj, int millisecondsTimeout, ref bool lockTaken) @@ -138,11 +112,6 @@ namespace System.Threading if (millisecondsTimeout < -1) throw new ArgumentOutOfRangeException("millisecondsTimeout", SR.ArgumentOutOfRange_NeedNonNegOrNegative1); -#if CORERT - // CORERT-TODO locks - lockTaken = true; - return; -#else Lock lck = GetLock(obj); if (lck.TryAcquire(0)) { @@ -150,8 +119,6 @@ namespace System.Threading return; } lockTaken = TryAcquireContended(lck, obj, millisecondsTimeout); - return; -#endif } public static bool TryEnter(Object obj, TimeSpan timeout) @@ -161,15 +128,10 @@ namespace System.Threading throw new ArgumentOutOfRangeException("timeout", SR.ArgumentOutOfRange_NeedNonNegOrNegative1); int millisecondsTimeout = (int)tm; -#if CORERT - // CORERT-TODO locks - return true; -#else Lock lck = GetLock(obj); if (lck.TryAcquire(0)) return true; return lck.TryAcquire(millisecondsTimeout); -#endif } public static void TryEnter(Object obj, TimeSpan timeout, ref bool lockTaken) @@ -181,11 +143,6 @@ namespace System.Threading throw new ArgumentOutOfRangeException("timeout", SR.ArgumentOutOfRange_NeedNonNegOrNegative1); int millisecondsTimeout = (int)tm; -#if CORERT - // CORERT-TODO locks - lockTaken = true; - return; -#else Lock lck = GetLock(obj); if (lck.TryAcquire(0)) { @@ -194,17 +151,11 @@ namespace System.Threading } lockTaken = TryAcquireContended(lck, obj, millisecondsTimeout); - return; -#endif } public static void Exit(Object obj) { -#if CORERT - // CORERT-TODO locks -#else GetLock(obj).Release(); -#endif } public static bool IsEntered(Object obj) |