X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.Threading%2FReaderWriterLock.cs;h=19feeff959169fe2f972aa375841bc300214bc84;hb=6ea7633b75f9ced0b86b36de20e933fdbdcb5776;hp=74e554031be7365dcb68e254af24f24633cf72fb;hpb=2007998771b1c4d9e762943676d7959daaf74385;p=mono.git diff --git a/mcs/class/corlib/System.Threading/ReaderWriterLock.cs b/mcs/class/corlib/System.Threading/ReaderWriterLock.cs index 74e554031be..19feeff9591 100644 --- a/mcs/class/corlib/System.Threading/ReaderWriterLock.cs +++ b/mcs/class/corlib/System.Threading/ReaderWriterLock.cs @@ -35,9 +35,19 @@ using System.Collections; +#if NET_2_0 +using System.Runtime.InteropServices; +using System.Runtime.ConstrainedExecution; +#endif + namespace System.Threading { +#if NET_2_0 + [ComVisible (true)] + public sealed class ReaderWriterLock: CriticalFinalizerObject +#else public sealed class ReaderWriterLock +#endif { private int seq_num = 1; private int state; @@ -50,15 +60,32 @@ namespace System.Threading { writer_queue = new LockQueue (this); reader_locks = new Hashtable (); + +#if NET_2_0 + GC.SuppressFinalize (this); +#endif + } + +#if NET_2_0 + [MonoTODO] + ~ReaderWriterLock () + { } +#endif public bool IsReaderLockHeld { +#if NET_2_0 + [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)] +#endif get { lock (this) return reader_locks.ContainsKey (Thread.CurrentThreadId); } } public bool IsWriterLockHeld { +#if NET_2_0 + [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)] +#endif get { lock (this) return (state < 0 && Thread.CurrentThreadId == writer_lock_owner); } @@ -187,6 +214,9 @@ namespace System.Threading return cookie; } +#if NET_2_0 + [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)] +#endif public void ReleaseReaderLock() { lock (this) { @@ -220,6 +250,9 @@ namespace System.Threading writer_queue.Pulse (); } +#if NET_2_0 + [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)] +#endif public void ReleaseWriterLock() { lock (this) {