Inheritance: System.EventArgs, IStopEvent
Exemplo n.º 1
0
        public async Task Stop(string reason)
        {
            var eventArgs = new StopEventArgs(reason);

            lock (_participants)
            {
                foreach (var participant in _participants)
                {
                    participant.Stop(eventArgs);
                }
            }

            await Completed.ConfigureAwait(false);

            _stopping.TrySetResult(eventArgs);
            _stopToken.Cancel();
        }
Exemplo n.º 2
0
        public async Task Stop(string reason, CancellationToken cancellationToken = default(CancellationToken))
        {
            var eventArgs = new StopEventArgs(reason);
            _stoppingToken.Cancel();
            _stopRequested.TrySetResultWithBackgroundContinuations(eventArgs);

            ITaskParticipant[] participants;
            lock (_participants)
                participants = _participants.Values.ToArray();

            foreach (var participant in participants)
            {
                participant.Stop(eventArgs);
            }

            await Completed.WithCancellation(cancellationToken).ConfigureAwait(false);

            _stoppedToken.Cancel();
        }
Exemplo n.º 3
0
        public async Task Stop(string reason, CancellationToken cancellationToken = default(CancellationToken))
        {
            var eventArgs = new StopEventArgs(reason);

            _stoppingToken.Cancel();
            _stopRequested.TrySetResult(eventArgs);

            lock (_participants)
            {
                foreach (var participant in _participants)
                {
                    participant.Value.Stop(eventArgs);
                }
            }

            await Completed.WithCancellation(cancellationToken).ConfigureAwait(false);

            _stoppedToken.Cancel();
        }
Exemplo n.º 4
0
        public async Task Stop(string reason)
        {
            var eventArgs = new StopEventArgs(reason);
            _stoppingToken.Cancel();
            _stopping.TrySetResult(eventArgs);

            lock (_participants)
            {
                foreach (var participant in _participants)
                {
                    participant.Stop(eventArgs);
                }
            }

            await Completed.ConfigureAwait(false);

            _stopToken.Cancel();
        }
Exemplo n.º 5
0
        public async Task Stop(string reason, CancellationToken cancellationToken = default(CancellationToken))
        {
            var eventArgs = new StopEventArgs(reason);
            _stoppingToken.Cancel();
            _stopRequested.TrySetResultWithBackgroundContinuations(eventArgs);

            ITaskParticipant[] participants;
            lock (_participants)
                participants = _participants.Values.ToArray();

            foreach (var participant in participants)
            {
                participant.Stop(eventArgs);
            }

            await Completed.WithCancellation(cancellationToken).ConfigureAwait(false);

            _stoppedToken.Cancel();
        }
Exemplo n.º 6
0
        public async Task Stop(string reason, CancellationToken cancellationToken = default(CancellationToken))
        {
            var eventArgs = new StopEventArgs(reason);
            _stoppingToken.Cancel();
            _stopRequested.TrySetResult(eventArgs);

            lock (_participants)
            {
                foreach (var participant in _participants)
                {
                    participant.Value.Stop(eventArgs);
                }
            }

            await Completed.WithCancellation(cancellationToken).ConfigureAwait(false);

            _stoppedToken.Cancel();
        }