public void Set()
        {
            var bd1 = new BooleanDisposable();
            var bd2 = new BooleanDisposable();

            var field = default(IDisposable);

            Assert.True(DisposableHelper.Set(ref field, bd1));

            Assert.False(bd1.IsDisposed());
            Assert.False(bd2.IsDisposed());

            Assert.True(DisposableHelper.Set(ref field, bd2));

            Assert.True(bd1.IsDisposed());
            Assert.False(bd2.IsDisposed());

            Assert.True(DisposableHelper.Dispose(ref field));

            Assert.True(bd1.IsDisposed());
            Assert.True(bd2.IsDisposed());

            var bd3 = new BooleanDisposable();

            Assert.False(DisposableHelper.Set(ref field, bd3));

            Assert.True(bd3.IsDisposed());
        }
            public void OnNext(T element)
            {
                var  curr = Volatile.Read(ref latest);
                long idx  = curr.index;

                if (idx != long.MaxValue)
                {
                    Entry e = new Entry(element, idx + 1, false);
                    if (Interlocked.CompareExchange(ref latest, e, curr) == curr)
                    {
                        DisposableHelper.Set(ref timer, worker.Schedule(() => Timeout(idx + 1), delay));
                    }
                }
            }
Ejemplo n.º 3
0
 internal void Set(IDisposable d)
 {
     DisposableHelper.Set(ref timer, d);
 }
 public void OnCancel(IDisposable disposable)
 {
     DisposableHelper.Set(ref this.disposable, disposable);
 }
Ejemplo n.º 5
0
 internal void Set(IDisposable sampler)
 {
     DisposableHelper.Set(ref this.sampler, sampler);
 }
Ejemplo n.º 6
0
 internal void Set(IDisposable d)
 {
     DisposableHelper.Set(ref this.resource, d);
 }
Ejemplo n.º 7
0
 public void Set(IDisposable value)
 {
     DisposableHelper.Set(ref d, value);
 }
Ejemplo n.º 8
0
 internal void Set(IDisposable d)
 {
     DisposableHelper.Set(ref this.d, d);
 }
Ejemplo n.º 9
0
 public bool Set(IDisposable d)
 {
     return(DisposableHelper.Set(ref this.d, d));
 }