Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FairReaderWriterLock"/> class.
        /// </summary>
        public FairReaderWriterLock(int lockTimeout)
        {
            _uMainLock    = new SpinLock(true);
            _uLockFlags   = LockFlags.None;
            _uSharedCount = 0;

            ReadLock  = new CommonReadLock(this, lockTimeout);
            WriteLock = new CommonWriteLock(this, lockTimeout);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SlimReaderWriterLock"/> class.
        /// </summary>
        public SlimReaderWriterLock(int lockTimeout)
        {
            _id          = Guid.NewGuid();
            _lockTimeout = lockTimeout;
#if MONO
            throw new NotSupportedException(ExceptionText);
#else
            _rwLock   = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
            ReadLock  = new CommonReadLock(this, _lockTimeout);
            WriteLock = new CommonWriteLock(this, _lockTimeout);

            _rDisposable = new TrackedDisposable(ReleaseReaderLock);
            _wDisposable = new TrackedDisposable(ReleaseWriterLock);
#endif
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FairReaderWriterLock"/> class.
        /// </summary>
        public FifoReaderWriterLock(int lockTimeout)
        {
#if STATISTICS
            _id = Convert.ToBase64String(Guid.NewGuid().ToByteArray());
#endif

            _wnode = _rnode = new Node(NodeFlags.None);

#if STATISTICS
            _wnode.LockId = _id;
#endif

            ReadLock  = new CommonReadLock <Node>(this, lockTimeout);
            WriteLock = new CommonWriteLock <Node>(this, lockTimeout);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StandardReaderWriterLock"/> class.
 /// </summary>
 public StandardReaderWriterLock(int lockTimeout)
 {
     _rwLock   = new ReaderWriterLock();
     ReadLock  = new CommonReadLock(this, lockTimeout);
     WriteLock = new CommonWriteLock(this, lockTimeout);
 }