Mercurial > pub > ImplabNet
comparison Implab/Parallels/BlockingQueue.cs @ 233:d6fe09f5592c v2
Improved AsyncQueue
Removed ImplabFx
author | cin |
---|---|
date | Wed, 04 Oct 2017 15:44:47 +0300 |
parents | 041b77711262 |
children | 7c7e9ad6fe4a |
comparison
equal
deleted
inserted
replaced
229:5f7a3e1d32b9 | 233:d6fe09f5592c |
---|---|
3 | 3 |
4 namespace Implab.Parallels { | 4 namespace Implab.Parallels { |
5 public class BlockingQueue<T> : AsyncQueue<T> { | 5 public class BlockingQueue<T> : AsyncQueue<T> { |
6 readonly object m_lock = new object(); | 6 readonly object m_lock = new object(); |
7 | 7 |
8 public override void Enqueue(T value) { | 8 public void EnqueuePulse(T value) { |
9 base.Enqueue(value); | 9 base.Enqueue(value); |
10 lock (m_lock) | 10 lock (m_lock) |
11 Monitor.Pulse(m_lock); | 11 Monitor.Pulse(m_lock); |
12 } | 12 } |
13 | 13 |
14 public override void EnqueueRange(T[] data, int offset, int length) { | 14 public void EnqueueRangePulse(T[] data, int offset, int length) { |
15 base.EnqueueRange(data, offset, length); | 15 base.EnqueueRange(data, offset, length); |
16 if (length > 1) | 16 if (length > 1) |
17 lock (m_lock) | 17 lock (m_lock) |
18 Monitor.PulseAll(m_lock); | 18 Monitor.PulseAll(m_lock); |
19 else | 19 else |