コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <summary>
 /// Adds a subscriber from this object (call on producer thread only)
 /// </summary>
 public void Unsubscribe(SubscriberQueue subscriber)
 {
     _subscriptions.Remove(subscriber);
 }