41 references to UnsafeRegister
Microsoft.AspNetCore.Mvc.Testing (2)
DeferredHostBuilder.cs (2)
148using var reg = cancellationToken.UnsafeRegister(_ => _hostStartedTcs.TrySetCanceled(), null); 152using var reg2 = _host.Services.GetRequiredService<IHostApplicationLifetime>().ApplicationStarted.UnsafeRegister(_ => _hostStartedTcs.TrySetResult(), null);
Microsoft.AspNetCore.SignalR.Core (2)
HubConnectionContext.cs (1)
501using (var registration = cts.Token.UnsafeRegister(_cancelReader, input))
src\SignalR\common\Shared\ClientResultsManager.cs (1)
140_tokenRegistration = _token.UnsafeRegister(static o =>
Microsoft.AspNetCore.SignalR.StackExchangeRedis (2)
RedisHubLifetimeManager.cs (1)
570tokenRegistration = connection.ConnectionAborted.UnsafeRegister(_ =>
src\SignalR\common\Shared\ClientResultsManager.cs (1)
140_tokenRegistration = _token.UnsafeRegister(static o =>
Microsoft.Extensions.Configuration (1)
src\libraries\Common\src\Extensions\ChangeCallbackRegistrar.cs (1)
27return token.UnsafeRegister(callback, state);
Microsoft.Extensions.Primitives (1)
src\libraries\Common\src\Extensions\ChangeCallbackRegistrar.cs (1)
27return token.UnsafeRegister(callback, state);
System.IO.Pipelines (5)
System\IO\Pipelines\PipeAwaitable.cs (1)
55_cancellationTokenRegistration = cancellationToken.UnsafeRegister(callback, state);
System\IO\Pipelines\StreamPipeReader.cs (3)
246reg = cancellationToken.UnsafeRegister(state => ((StreamPipeReader)state!).Cancel(), reader); 322reg = cancellationToken.UnsafeRegister(state => ((StreamPipeReader)state!).Cancel(), this); 393reg = cancellationToken.UnsafeRegister(state => ((StreamPipeReader)state!).Cancel(), this);
System\IO\Pipelines\StreamPipeWriter.cs (1)
299reg = cancellationToken.UnsafeRegister(state => ((StreamPipeWriter)state!).Cancel(), this);
System.Net.Http (5)
System\Net\Http\SocketsHttpHandler\ConnectHelper.cs (1)
72using (cancellationToken.UnsafeRegister(static s => ((Stream)s!).Dispose(), stream))
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (1)
676using (cancellationToken.UnsafeRegister(static s => ((Socket)s!).Dispose(), socket))
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (2)
347using (cancellationToken.UnsafeRegister(static s => ((TaskCompletionSource<bool>)s!).TrySetResult(false), waiter)) 1412cancellationToken.UnsafeRegister(static s => ((CancellationTokenSource)s!).Cancel(), _requestBodyCancellationSource);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (1)
162CancellationTokenRegistration linkedTokenRegistration = cancellationToken.UnsafeRegister(cts => ((CancellationTokenSource)cts!).Cancel(), _requestBodyCancellationSource);
System.Net.Ping (1)
System\Net\NetworkInformation\Ping.cs (1)
717using CancellationTokenRegistration _ = cancellationToken.UnsafeRegister(static state => ((Ping)state!).SetCanceled(), this);
System.Net.Requests (1)
System\Net\HttpWebRequest.cs (1)
1861using (cancellationToken.UnsafeRegister(s => ((Socket)s!).Dispose(), socket))
System.Net.Sockets (1)
System\Net\Sockets\SocketAsyncContext.Unix.cs (1)
890operation.CancellationRegistration = cancellationToken.UnsafeRegister(s => ((TOperation)s!).TryCancel(), operation);
System.Private.CoreLib (9)
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (4)
895_reg1 = token1.UnsafeRegister(LinkedNCancellationTokenSource.s_linkedTokenCancelDelegate, this); 917_reg1 = token1.UnsafeRegister(LinkedNCancellationTokenSource.s_linkedTokenCancelDelegate, this); 918_reg2 = token2.UnsafeRegister(LinkedNCancellationTokenSource.s_linkedTokenCancelDelegate, this); 951_linkingRegistrations[i] = tokens[i].UnsafeRegister(s_linkedTokenCancelDelegate, this);
src\libraries\System.Private.CoreLib\src\System\Threading\ManualResetEventSlim.cs (1)
541using (cancellationToken.UnsafeRegister(s_cancellationTokenCallback, this))
src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (1)
338CancellationTokenRegistration cancellationTokenRegistration = cancellationToken.UnsafeRegister(s_cancellationTokenCanceledEventHandler, this);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
710ctr = cancellationToken.UnsafeRegister(static t => ((Task)t!).InternalCancel(), this); 719ctr = cancellationToken.UnsafeRegister(static t =>
src\System\Runtime\ControlledExecution.CoreCLR.cs (1)
65CancellationTokenRegistration ctr = cancellationToken.UnsafeRegister(e => ((Canceler)e!).Cancel(), canceler);
System.ServiceModel.Http (1)
System\ServiceModel\Channels\HttpChannelFactory.cs (1)
1054using (timeoutToken.UnsafeRegister(s_cancelCts, _httpSendCts))
System.ServiceModel.Primitives (3)
Internals\System\Runtime\TimeoutHelper.cs (1)
324token.UnsafeRegister(s_deregisterToken, Tuple.Create(targetTime, tokenSource));
System\ServiceModel\Channels\ProducerConsumerStream.cs (2)
85using (cancellationToken.UnsafeRegister(CancelAndDispose, this)) 129using (cancellationToken.UnsafeRegister(CancelAndDispose, this))
System.Threading.RateLimiting (4)
System\Threading\RateLimiting\ConcurrencyLimiter.cs (1)
433_cancellationTokenRegistration = cancellationToken.UnsafeRegister(Cancel, this);
System\Threading\RateLimiting\FixedWindowRateLimiter.cs (1)
471_cancellationTokenRegistration = cancellationToken.UnsafeRegister(Cancel, this);
System\Threading\RateLimiting\SlidingWindowRateLimiter.cs (1)
484_cancellationTokenRegistration = cancellationToken.UnsafeRegister(Cancel, this);
System\Threading\RateLimiting\TokenBucketRateLimiter.cs (1)
485_cancellationTokenRegistration = cancellationToken.UnsafeRegister(Cancel, this);
System.Threading.Tasks.Parallel (3)
System\Threading\Tasks\Parallel.cs (2)
955: parallelOptions.CancellationToken.UnsafeRegister((o) => 2554: parallelOptions.CancellationToken.UnsafeRegister((o) =>
System\Threading\Tasks\Parallel.ForEachAsync.cs (1)
553_registration = cancellationToken.UnsafeRegister(static o => ((ForEachAsyncState<TSource>)o!).Cancellation.Cancel(), this);