Inheritance: ITaskParticipant
Beispiel #1
0
        public ITaskParticipant CreateParticipant(string tag)
        {
            if (_stoppingToken.IsCancellationRequested)
                throw new OperationCanceledException("The supervisor is stopping, no additional participants can be created");

            var id = Interlocked.Increment(ref _nextId);

            var participant = new TaskParticipant(tag, () => RemoveParticipant(id));
            lock (_participants)
            {
                _participants.Add(id, participant);
            }

            return participant;
        }
Beispiel #2
0
        public ITaskParticipant CreateParticipant(string tag)
        {
            if (_stoppingToken.IsCancellationRequested)
                throw new OperationCanceledException("The supervisor is stopping, no additional participants can be created");

            long id = Interlocked.Increment(ref _nextId);

            var participant = new TaskParticipant(tag, () => RemoveParticipant(id));
            lock (_participants)
            {
                _participants.Add(id, participant);
            }

            return participant;
        }
Beispiel #3
0
        public ITaskParticipant CreateParticipant(string tag)
        {
            if (_stoppingToken.IsCancellationRequested)
            {
                throw new OperationCanceledException("The supervisor is stopping, no additional participants can be created");
            }

            var participant = new TaskParticipant(tag);

            lock (_participants)
            {
                _participants.Add(participant);
            }

            return(participant);
        }