/// <summary> /// Adds a subscriber to this object (call on producer thread only) /// </summary> public void Subscribe(SubscriberQueue subscriber) { Subscription subscription; if (_subscriptions.TryGetValue(subscriber, out subscription)) { throw new ArgumentException("Cannot add same subscriber twice", "subscriber"); } subscription = new Subscription(); _subscriptions.Add(subscriber, subscription); }
/// <summary> /// Adds a subscriber from this object (call on producer thread only) /// </summary> public void Unsubscribe(SubscriberQueue subscriber) { _subscriptions.Remove(subscriber); }