25 lines
597 B
C#
25 lines
597 B
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.Threading;
|
|
|
|
namespace Microsoft.AspNetCore.SignalR.Tests
|
|
{
|
|
internal class CancellationDisposable : IDisposable
|
|
{
|
|
private readonly CancellationTokenSource _cts;
|
|
|
|
public CancellationDisposable(CancellationTokenSource cts)
|
|
{
|
|
_cts = cts;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_cts.Cancel();
|
|
_cts.Dispose();
|
|
}
|
|
}
|
|
}
|