/// <summary> /// Constructor. /// </summary> public BrokerQueue() { this.queue = new QueueArray <TItem>(); this.wait = new AutoResetEvent(false); this.isOpen = true; this.cDequeue = 0; }
/// <summary> /// Closes the broker. All pending <see cref="Dequeue" /> /// calls will return <c>null</c>. /// </summary> public void Close() { lock (syncLock) { if (!isOpen) { return; } queue = null; isOpen = false; if (cDequeue == 0) { wait.Close(); } else { wait.Set(); } } }