コード例 #1
0
ファイル: TaskSupervisor.cs プロジェクト: zzms/MassTransit
        public ITaskScope CreateScope(string tag)
        {
            if (_stoppingToken.IsCancellationRequested)
                throw new OperationCanceledException("The supervisor is stopping, no additional scopes can be created");

            var id = Interlocked.Increment(ref _nextId);

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

            return scope;
        }
コード例 #2
0
        public ITaskScope CreateScope(string tag)
        {
            if (_stoppingToken.IsCancellationRequested)
            {
                throw new OperationCanceledException("The supervisor is stopping, no additional scopes can be created");
            }

            var scope = new TaskScope(tag);

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

            return(scope);
        }
コード例 #3
0
        public ITaskScope CreateScope(string tag)
        {
            if (_stoppingToken.IsCancellationRequested)
                throw new OperationCanceledException("The supervisor is stopping, no additional scopes can be created");

            var id = Interlocked.Increment(ref _nextId);

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

            return scope;
        }