Split ReaderWriterLockSlim helper classes into their own files
authorJérémie Laval <jeremie.laval@gmail.com>
Wed, 1 Sep 2010 10:05:59 +0000 (11:05 +0100)
committerJérémie Laval <jeremie.laval@gmail.com>
Wed, 1 Sep 2010 10:10:09 +0000 (11:10 +0100)
mcs/class/System.Core/System.Core.dll.sources
mcs/class/System.Core/System.Threading/ReaderWriterLockSlim.cs
mcs/class/System.Core/System.Threading/ReaderWriterLockSlimExtensions.cs [new file with mode: 0644]
mcs/class/System.Core/System.Threading/ThreadLockState.cs [new file with mode: 0644]
mcs/class/System.Core/net_4_0_System.Core.dll.sources

index d415c2f5ac6ade11d3059e143066a7116b4c1d57..4a5fdbd61813eb194da56e2281847f75ade2af27 100644 (file)
@@ -85,6 +85,8 @@ System.Threading/LockRecursionException.cs
 System.Threading/LockRecursionPolicy.cs
 System.Threading/ReaderWriterLockSlim.cs
 ../corlib/System.Threading/AtomicBoolean.cs
+System.Threading/ThreadLockState.cs
+System.Threading/ReaderWriterLockSlimExtensions.cs
 Microsoft.Win32.SafeHandles/SafePipeHandle.cs
 System.IO.Pipes/AnonymousPipeClientStream.cs
 System.IO.Pipes/AnonymousPipeServerStream.cs
index cc49a91e595f58b242a78a63a70c1ff966478740..63a132372f3810c47465585571350028cd7e6f85 100644 (file)
@@ -35,43 +35,6 @@ using System.Threading;
 
 namespace System.Threading {
 
-       [Flags]
-       internal enum ThreadLockState
-       {
-               None = 0,
-               Read = 1,
-               Write = 2,
-               Upgradable = 4,
-               UpgradedRead = 5,
-               UpgradedWrite = 6
-       }
-
-       internal static class ReaderWriterLockSlimExtensions
-       {
-               internal static bool Has (this ThreadLockState state, ThreadLockState value)
-               {
-                       return (state & value) > 0;
-               }
-
-#if !NET_4_0 && !NET_4_0_BOOTSTRAP
-               internal static bool Wait (this ManualResetEvent self, int timeout)
-               {
-                       return self.WaitOne (timeout);
-               }
-
-               internal static bool IsSet (this ManualResetEvent self)
-               {
-                       return self.WaitOne (0);
-               }
-#else
-               internal static bool IsSet (this ManualResetEventSlim self)
-               {
-                       return self.IsSet;
-               }
-#endif
-       }
-
-
        [HostProtectionAttribute(SecurityAction.LinkDemand, MayLeakOnAbort = true)]
        [HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true, ExternalThreading = true)]
        public class ReaderWriterLockSlim : IDisposable
diff --git a/mcs/class/System.Core/System.Threading/ReaderWriterLockSlimExtensions.cs b/mcs/class/System.Core/System.Threading/ReaderWriterLockSlimExtensions.cs
new file mode 100644 (file)
index 0000000..a4761da
--- /dev/null
@@ -0,0 +1,57 @@
+//
+// ReaderWriterLockSlimExtensions.cs
+//
+// Author:
+//       Jérémie "Garuma" Laval <jeremie.laval@gmail.com>
+//
+// Copyright (c) 2010 Jérémie "Garuma" Laval
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace System.Threading
+{
+       internal static class ReaderWriterLockSlimExtensions
+       {
+               internal static bool Has (this ThreadLockState state, ThreadLockState value)
+               {
+                       return (state & value) > 0;
+               }
+
+#if !NET_4_0 && !NET_4_0_BOOTSTRAP
+               internal static bool Wait (this ManualResetEvent self, int timeout)
+               {
+                       return self.WaitOne (timeout);
+               }
+
+               internal static bool IsSet (this ManualResetEvent self)
+               {
+                       return self.WaitOne (0);
+               }
+#else
+               internal static bool IsSet (this ManualResetEventSlim self)
+               {
+                       return self.IsSet;
+               }
+#endif
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Core/System.Threading/ThreadLockState.cs b/mcs/class/System.Core/System.Threading/ThreadLockState.cs
new file mode 100644 (file)
index 0000000..9a5b5f6
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// ThreadLockState.cs
+//
+// Author:
+//       Jérémie "Garuma" Laval <jeremie.laval@gmail.com>
+//
+// Copyright (c) 2010 Jérémie "Garuma" Laval
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace System.Threading
+{
+       [Flags]
+       internal enum ThreadLockState
+       {
+               None = 0,
+               Read = 1,
+               Write = 2,
+               Upgradable = 4,
+               UpgradedRead = 5,
+               UpgradedWrite = 6
+       }
+}
\ No newline at end of file
index aba71046ddb90d6682e4a0816f60b8dbcc8d37d2..601ef4a5b289235a8354bda629f519b992e581de 100644 (file)
@@ -66,6 +66,8 @@ System.Security.Cryptography/SHA512CryptoServiceProvider.cs
 System.Threading/LockRecursionException.cs
 System.Threading/LockRecursionPolicy.cs
 System.Threading/ReaderWriterLockSlim.cs
+System.Threading/ThreadLockState.cs
+System.Threading/ReaderWriterLockSlimExtensions.cs
 
 System.Linq.Expressions/Extensions.cs
 System.Linq.Expressions/ExpressionTransformer.cs