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)); } } }
internal void Set(IDisposable d) { DisposableHelper.Set(ref timer, d); }
public void OnCancel(IDisposable disposable) { DisposableHelper.Set(ref this.disposable, disposable); }
internal void Set(IDisposable sampler) { DisposableHelper.Set(ref this.sampler, sampler); }
internal void Set(IDisposable d) { DisposableHelper.Set(ref this.resource, d); }
public void Set(IDisposable value) { DisposableHelper.Set(ref d, value); }
internal void Set(IDisposable d) { DisposableHelper.Set(ref this.d, d); }
public bool Set(IDisposable d) { return(DisposableHelper.Set(ref this.d, d)); }