public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         BackpressureHelper.PostCompleteRequest(ref requested, n, queue, actual, ref cancelled);
     }
 }
Beispiel #2
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         requested.AddCap(n);
     }
 }
 public void OnSubscribe(IDisposable d)
 {
     if (OnSubscribeHelper.SetDisposable(ref this.d, d))
     {
         actual.OnSubscribe(this);
     }
 }
Beispiel #4
0
 public void OnSubscribe(ISubscription s)
 {
     if (OnSubscribeHelper.SetSubscription(ref other, s))
     {
         s.Request(long.MaxValue);
     }
 }
Beispiel #5
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         BackpressureHelper.Add(ref requested, n);
     }
 }
Beispiel #6
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         s.Request(long.MaxValue);
     }
 }
Beispiel #7
0
 /// <summary>
 /// Requests the specified amount immediately or once the actual
 /// subscription arrives (validated).
 /// </summary>
 /// <param name="n"></param>
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         BackpressureHelper.SingleRequest(ref this.s, ref requested, n);
     }
 }
Beispiel #8
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         sds.Request(n, actual);
     }
 }
        /// <summary>
        /// Atomically tries to set the first value on the target field and returns
        /// false if its not null.
        /// </summary>
        /// <param name="field"></param>
        /// <param name="first"></param>
        /// <returns></returns>
        public static bool SetOnce(ref ISubscription field, ISubscription first)
        {
            for (;;)
            {
                ISubscription a = Volatile.Read(ref field);
                if (a == Cancelled)
                {
                    first?.Cancel();
                    return(false);
                }

                if (a != null)
                {
                    first?.Cancel();

                    OnSubscribeHelper.ReportSubscriptionSet();
                    return(false);
                }

                if (Interlocked.CompareExchange(ref field, first, null) == null)
                {
                    return(true);
                }
            }
        }
 public void OnSubscribe(IDisposable d)
 {
     if (!DisposableHelper.SetOnce(ref s, d))
     {
         OnSubscribeHelper.ReportDisposableSet();
     }
 }
Beispiel #11
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         BackpressureHelper.ScalarPostCompleteRequest(ref requested, n, ref value, actual);
     }
 }
Beispiel #12
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         arbiter.Request(n);
     }
 }
Beispiel #13
0
 public void OnSubscribe(ISubscription s)
 {
     if (OnSubscribeHelper.SetSubscription(ref this.s, s))
     {
         actual.OnSubscribe(this);
     }
 }
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         bp.Request(n);
         Drain();
     }
 }
 public void OnSubscribe(IDisposable d)
 {
     if (!DisposableHelper.SetOnce(ref this.d, d))
     {
         d?.Dispose();
         OnSubscribeHelper.ReportDisposableSet();
     }
 }
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         long u = BackpressureHelper.MultiplyCap(n, size);
         s.Request(u);
     }
 }
Beispiel #17
0
        public void Request(long n)
        {
            if (OnSubscribeHelper.ValidateRequest(n))
            {
                bp.Request(n);

                Schedule();
            }
        }
        public void OnSubscribe(ISubscription s)
        {
            if (OnSubscribeHelper.SetSubscription(ref this.s, s))
            {
                actual.OnSubscribe(this);

                s.Request(long.MaxValue);
            }
        }
        public void OnSubscribe(IDisposable d)
        {
            if (OnSubscribeHelper.SetDisposable(ref this.d, d))
            {
                actual.OnSubscribe(this);

                IDisposable a = scheduler.ScheduleDirect(() => OnTimeout(), timeout);
                DisposableHelper.Replace(ref t, a);
            }
        }
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         if (Interlocked.CompareExchange(ref once, 1, 0) == 0)
         {
             actual.OnNext(value);
             actual.OnComplete();
         }
     }
 }
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         if (BackpressureHelper.SetRequest(ref state, ref value))
         {
             actual.OnNext(value);
             actual.OnComplete();
         }
     }
 }
Beispiel #22
0
        public void OnSubscribe(ISubscription s)
        {
            if (OnSubscribeHelper.SetSubscription(ref this.s, s))
            {
                actual.OnSubscribe(this);

                if (!arbiter.IsCancelled())
                {
                    s.Request(prefetch);
                }
            }
        }
 public void OnSubscribe(ISubscription s)
 {
     if (SubscriptionHelper.SetOnce(ref this.other, s))
     {
         s.Request(long.MaxValue);
     }
     else
     {
         s.Cancel();
         OnSubscribeHelper.ReportSubscriptionSet();
     }
 }
Beispiel #24
0
 public void OnSubscribe(IDisposable d)
 {
     if (DisposableHelper.SetOnce(ref this.d, d))
     {
         actual.OnSubscribe(this);
     }
     else
     {
         d?.Dispose();
         OnSubscribeHelper.ReportDisposableSet();
     }
 }
Beispiel #25
0
            public void Request(long n)
            {
                if (OnSubscribeHelper.ValidateRequest(n))
                {
                    BackpressureHelper.Add(ref requested, n);

                    var m = Volatile.Read(ref parent);
                    if (m != null)
                    {
                        m.Drain();
                    }
                }
            }
Beispiel #26
0
        public void OnSubscribe(IDisposable d)
        {
            if (OnSubscribeHelper.SetDisposable(ref upstream, d))
            {
                actual.OnSubscribe(this);

                IDisposable t = scheduler.ScheduleDirect(() =>
                {
                    SubscribeOther();
                }, timeout);

                DisposableHelper.Replace(ref timer, t);
            }
        }
Beispiel #27
0
        public void OnSubscribe(ISubscription s)
        {
            try
            {
                onSubscribeCall?.Invoke(s);
            }
            catch (Exception e)
            {
                RxAdvancedFlowPlugins.OnError(e);
            }

            if (OnSubscribeHelper.SetSubscription(ref this.s, s))
            {
                actual.OnSubscribe(this);
            }
        }
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         if (BackpressureHelper.Add(ref requested, n) == 0)
         {
             if (n == long.MaxValue)
             {
                 FastPath();
             }
             else
             {
                 SlowPath(n);
             }
         }
     }
 }
Beispiel #29
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         if (BackpressureHelper.Add(ref requested, n) == 0)
         {
             long idx = index;
             if (n >= idx)
             {
                 FastPath(idx);
             }
             else
             {
                 SlowPath(idx, n);
             }
         }
     }
 }
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         if (Volatile.Read(ref requestOnce) == 0 &&
             Interlocked.CompareExchange(ref requestOnce, 1, 0) == 0)
         {
             long u = BackpressureHelper.MultiplyCap(skip, n - 1);
             long v = BackpressureHelper.AddCap(u, n);
             s.Request(v);
         }
         else
         {
             long u = BackpressureHelper.MultiplyCap(skip, n);
             s.Request(u);
         }
     }
 }