Beispiel #1
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         requested.AddCap(n);
     }
 }
Beispiel #2
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         arbiter.Request(n);
     }
 }
Beispiel #3
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         sds.Request(n, actual);
     }
 }
Beispiel #4
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         BackpressureHelper.Add(ref requested, n);
     }
 }
Beispiel #5
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 #6
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         s.Request(long.MaxValue);
     }
 }
Beispiel #7
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         BackpressureHelper.ScalarPostCompleteRequest(ref requested, n, ref value, actual);
     }
 }
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         BackpressureHelper.PostCompleteRequest(ref requested, n, queue, actual, ref cancelled);
     }
 }
            public void Request(long n)
            {
                if (OnSubscribeHelper.ValidateRequest(n))
                {
                    ISubscription a = Volatile.Read(ref secondSubscription);

                    if (a == null)
                    {
                        BackpressureHelper.Add(ref requested, n);

                        a = Volatile.Read(ref secondSubscription);

                        if (a != null)
                        {
                            long r = Interlocked.Exchange(ref requested, 0);

                            if (r != 0)
                            {
                                a.Request(r);
                            }
                        }
                    }
                    else
                    {
                        a.Request(n);
                    }
                }
            }
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         long u = BackpressureHelper.MultiplyCap(n, size);
         s.Request(u);
     }
 }
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         bp.Request(n);
         Drain();
     }
 }
Beispiel #12
0
        public void Request(long n)
        {
            if (OnSubscribeHelper.ValidateRequest(n))
            {
                bp.Request(n);

                Schedule();
            }
        }
 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 #15
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();
                    }
                }
            }
 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 #17
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);
         }
     }
 }
Beispiel #19
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         if (BackpressureHelper.PostCompleteRequest(ref requested, n, buffers, actual, ref cancelled))
         {
             if (Volatile.Read(ref once) == 0 && Interlocked.CompareExchange(ref once, 1, 0) == 0)
             {
                 long u = BackpressureHelper.MultiplyCap(skip, n - 1);
                 long v = BackpressureHelper.AddCap(size, u);
                 s.Request(v);
             }
             else
             {
                 long u = BackpressureHelper.MultiplyCap(skip, n);
                 s.Request(u);
             }
         }
     }
 }
Beispiel #20
0
 public void Request(long n)
 {
     if (OnSubscribeHelper.ValidateRequest(n))
     {
         if (Volatile.Read(ref once) == 0 && Interlocked.CompareExchange(ref once, 1, 0) == 0)
         {
             if (n >= limit)
             {
                 s.Request(long.MaxValue);
             }
             else
             {
                 s.Request(n);
             }
         }
         else
         {
             s.Request(n);
         }
     }
 }
Beispiel #21
0
        public void Request(long n)
        {
            if (!OnSubscribeHelper.ValidateRequest(n))
            {
                return;
            }

            int w = Volatile.Read(ref winner);

            if (w != int.MinValue)
            {
                subscriptions[w].Request(n);
            }
            else
            {
                foreach (InnerSubscription i in subscriptions)
                {
                    i.Request(n);
                }
            }
        }
        /// <summary>
        /// Request from the current actual ISubscriber (validated).
        /// </summary>
        /// <param name="n">The request amount. Validated</param>
        public void Request(long n)
        {
            if (Volatile.Read(ref cancelled))
            {
                return;
            }

            if (OnSubscribeHelper.ValidateRequest(n))
            {

                if (Volatile.Read(ref wip) == 0)
                {
                    int j = Interlocked.CompareExchange(ref wip, 1, 0);

                    if (j == 0)
                    {

                        requested = BackpressureHelper.AddCap(requested, n);

                        actual?.Request(n);

                        if (Interlocked.Decrement(ref wip) == 0)
                        {
                            return;
                        }
                    }
                }

                BackpressureHelper.Add(ref missedRequested, n);
                    
                if (Interlocked.Increment(ref wip) == 1)
                {
                    Drain();
                }
            }
        }