public static CancellationToken AsToken(RemoteCancellationToken remoteToken) { var sink = new InternalRemoteCancellationTokenSink(); remoteToken.InternalRegisterSink(sink); return(sink.Token); }
public void InternalRegisterSink(InternalRemoteCancellationTokenSink sink) { token_.Register(() => { try { sink.Cancel(); } catch { // Ignore remote call if raised. (May be discarded AppDomain) } }); }