Exemple #1
0
        // Constructor
        /// <summary></summary>
        /// <param name="getEnumeratorDelegate"></param>
        /// <param name="readerWriterLock"></param>
        public ThreadSafeEnumerator(Func<IEnumerator<T>> getEnumeratorDelegate, ThreadSafeReaderWriterLock readerWriterLock)
        {
            #region Require
            if (getEnumeratorDelegate == null) throw new ArgumentNullException();
            if (readerWriterLock == null) throw new ArgumentNullException();
            #endregion

            // ReaderWriterLock
            _readerWriterLock = readerWriterLock;
            _readerWriterLock.EnterReadLock();

            // Component
            _component = getEnumeratorDelegate();
        }
Exemple #2
0
 // Methods
 /// <summary></summary>
 protected void EnterReadLock()
 {
     _readerWriterLock.EnterReadLock();
 }