Inheritance: System.EventArgs, IStopEvent
Beispiel #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();
        }
Beispiel #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();
        }
Beispiel #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();
        }
Beispiel #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();
        }
        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();
        }
Beispiel #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();
        }