ChangeCallbackRegistrar
using Microsoft.Extensions.FileProviders;
using System;
using System.Runtime.CompilerServices;
using System.Threading;
namespace Microsoft.Extensions.Internal
{
internal static class ChangeCallbackRegistrar
{
[NullableContext(1)]
internal static IDisposable UnsafeRegisterChangeCallback<[Nullable(2)] T>([Nullable(new byte[] {
1,
2
})] Action<object> callback, [Nullable(2)] object state, CancellationToken token, Action<T> onFailure, T onFailureState)
{
try {
return token.UnsafeRegister(callback, state);
} catch (ObjectDisposedException) {
onFailure(onFailureState);
}
return Microsoft.Extensions.FileProviders.EmptyDisposable.Instance;
}
}
}