Exemple #1
0
        public IDisposable AddSubscriber(Action <TNextArg> onNextAction, Action <Exception> errorAction)
        {
            var ssi = new SingleSubscriberInfo <TNextArg>(
                new ReactiveActions <TNextArg>(onNextAction, errorAction));

            var d = new FridayDisposable(() => { UnsubscribeSingleClient(ssi); });

            lock (this)
            {
                subscribers.Add(ssi);
            }

            return(d);
        }
Exemple #2
0
        private void UnsubscribeSingleClient(SingleSubscriberInfo <TNextArg> ssi)
        {
            bool blockIsAlive;

            lock (this)
            {
                subscribers.Remove(ssi);
                blockIsAlive = subscribers.Any();
            }

            if (!blockIsAlive)
            {
                DisposeThisBlock();
            }
        }
 public bool Equals(SingleSubscriberInfo <TNextArg> other)
 {
     return(Equals(Actions, other.Actions));
 }