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