Example #1
0
 /// <summary>
 /// Inserts a type T object into the queue
 /// </summary>
 /// <param name="queueItem">T queue object</param>
 public void Enqueue(T queueItem)
 {
     using (AutoLock.LockToWrite(_lock, _timeout))
     {
         _queue.Enqueue(queueItem);
     }
 }
Example #2
0
 public void Clear( )
 {
     using (AutoLock.LockToWrite(_lock, _timeout))
     {
         _dictionary.Clear( );
     }
 }
Example #3
0
 public void Add(K key, V value)
 {
     using (AutoLock.LockToWrite(_lock, _timeout))
     {
         _dictionary.Add(key, value);
     }
 }
Example #4
0
 public bool TryGetValue(K key, out V value)
 {
     using (AutoLock.LockToWrite(_lock, _timeout))
     {
         return(_dictionary.TryGetValue(key, out value));
     }
 }
Example #5
0
 public void Remove(K key)
 {
     using (AutoLock.LockToWrite(_lock, _timeout))
     {
         _dictionary.Remove(key);
     }
 }
Example #6
0
        /// <summary>
        /// Removes the beginning item from the queue and returns the item
        /// </summary>
        /// <returns>type T item or default T if the queue is empty</returns>
        public T Dequeue( )
        {
            using (AutoLock.LockToWrite(_lock, _timeout))
            {
                if (0 != _queue.Count)
                {
                    return(_queue.Dequeue( ));
                }
            }

            return(default(T));
        }
Example #7
0
 public V this [K key]
 {
     get { using (AutoLock.LockToRead(_lock, _timeout)) { return(_dictionary [key]); } }
     set { using (AutoLock.LockToWrite(_lock, _timeout)) { _dictionary [key] = value; } }
 }