예제 #1
0
        /// <inheritdoc/>
        protected override async ValueTask DisposeAsyncCore()
        {
            if (this.IsDisposed)
            {
                return;
            }
            if (_cts_sub is IAsyncDisposable asyncDisposable0)
            {
                await asyncDisposable0.ConfigureAwait(false).DisposeAsync();
            }
            else
            {
                _cts_sub.Dispose();
            }
            await _ctr_main.ConfigureAwait(false).DisposeAsync();

            if (_cts_main is IAsyncDisposable asyncDisposable1)
            {
                await asyncDisposable1.ConfigureAwait(false).DisposeAsync();
            }
            else
            {
                _cts_main.Dispose();
            }
            if (_rng is IAsyncDisposable asyncDisposable2)
            {
                await asyncDisposable2.ConfigureAwait(false).DisposeAsync();
            }
            else
            {
                _rng.Dispose();
            }
            _thread.ExecutionContext?.Dispose();
            await base.DisposeAsyncCore();
        }