Example #1
0
        /// <summary>
        /// Subscribe with the relaxed IFlowableSubscriber instance.
        /// </summary>
        /// <param name="subscriber">The IFlowableSubscriber instance, not null.</param>
        public void Subscribe(IFlowableSubscriber <T> subscriber)
        {
            var ps = new ProcessorSubscription(subscriber, this);

            subscriber.OnSubscribe(ps);
            if (Add(ps))
            {
                if (ps.IsCancelled())
                {
                    Remove(ps);
                }
            }
            else
            {
                Exception ex = error;
                if (ex != null)
                {
                    ps.Error(ex);
                }
                else
                if (hasValue)
                {
                    ps.Complete(value);
                }
                else
                {
                    ps.Complete();
                }
            }
        }
Example #2
0
 /// <summary>
 /// Subscribe with the relaxed IFlowableSubscriber instance.
 /// </summary>
 /// <param name="subscriber">The IFlowableSubscriber instance, not null.</param>
 public void Subscribe(IFlowableSubscriber<T> subscriber)
 {
     ProcessorSubscription ps = new ProcessorSubscription(subscriber, this);
     subscriber.OnSubscribe(ps);
     if (Add(ps))
     {
         if (ps.IsCancelled())
         {
             Remove(ps);
             return;
         }
     }
     else
     {
         Exception ex = error;
         if (ex != null)
         {
             ps.OnError(ex);
         }
         else
         {
             ps.OnComplete();
         }
     }
 }