• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IAsyncToken类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IAsyncToken的典型用法代码示例。如果您正苦于以下问题:C# IAsyncToken类的具体用法?C# IAsyncToken怎么用?C# IAsyncToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IAsyncToken类属于命名空间,在下文中一共展示了IAsyncToken类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RegisterNotification

        public void RegisterNotification(Func<bool> action, int delay, IAsyncToken asyncToken, CancellationToken cancellationToken = default(CancellationToken))
        {
            Contract.Requires(delay >= 0);

            var current = Environment.TickCount;

            _workQueue.Enqueue(new PendingWork(current + delay, action, asyncToken, cancellationToken));
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:8,代码来源:ForegroundNotificationService.cs


示例2: WorkItem

 public WorkItem(
     DocumentId documentId, string language, InvocationReasons invocationReasons, bool isLowPriority,
     SyntaxPath activeMember, IAsyncToken asyncToken)
     : this(documentId, documentId.ProjectId, language, invocationReasons, isLowPriority,
            activeMember, ImmutableHashSet.Create<IIncrementalAnalyzer>(),
            false, asyncToken)
 {
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:8,代码来源:WorkCoordinator.WorkItem.cs


示例3: CompletesAsyncOperation

        public static Task CompletesAsyncOperation(this Task task, IAsyncToken asyncToken)
        {
            var diagnosticToken = asyncToken as AsynchronousOperationListener.DiagnosticAsyncToken;
            if (diagnosticToken != null)
            {
                diagnosticToken.AssociateWithTask(task);
            }

            return task.CompletesTrackingOperation(asyncToken);
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:10,代码来源:TaskExtensions.cs


示例4: RegisterNotification

        public void RegisterNotification(Func<bool> action, int delayInMS, IAsyncToken asyncToken, CancellationToken cancellationToken = default(CancellationToken))
        {
            Task task;
            lock (_gate)
            {
                task = _queue.ScheduleTask(() => Execute_NoLock(action, asyncToken, cancellationToken), cancellationToken);
                _tasks.Add(task);
            }

            task.Wait(cancellationToken);
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:11,代码来源:TestForegroundNotificationService.cs


示例5: Execute_NoLock

 private void Execute_NoLock(Func<bool> action, IAsyncToken asyncToken, CancellationToken cancellationToken)
 {
     if (action())
     {
         asyncToken.Dispose();
     }
     else
     {
         _tasks.Add(_queue.ScheduleTask(() => Execute_NoLock(action, asyncToken, cancellationToken), cancellationToken));
     }
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:11,代码来源:TestForegroundNotificationService.cs


示例6: Search

            private void Search(IDisposable navigateToSearch, IAsyncToken asyncToken)
            {
                var searchTasks = _solution.Projects.Select(SearchAsync).ToArray();
                var whenAllTask = Task.WhenAll(searchTasks);

                // NOTE(cyrusn) This SafeContinueWith is *not* cancellable.  We must dispose of the notifier
                // in order for tests to work property.  Also, if we don't notify the callback that we're
                // done then the UI will never stop displaying the progress bar.
                whenAllTask.SafeContinueWith(_ =>
                {
                    _callback.Done();
                    navigateToSearch.Dispose();
                    asyncToken.Dispose();
                },
                CancellationToken.None,
                TaskContinuationOptions.ExecuteSynchronously,
                TaskScheduler.Default);
            }
开发者ID:Rickinio,项目名称:roslyn,代码行数:18,代码来源:NavigateToItemProvider.Searcher.cs


示例7: PendingWork

 public PendingWork(int minimumRunPointInMS, Action work, IAsyncToken asyncToken, CancellationToken cancellationToken)
     : this(minimumRunPointInMS, work, null, asyncToken, cancellationToken)
 {
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:4,代码来源:ForegroundNotificationService.cs


示例8: EnqueueEvent

 private void EnqueueEvent(Solution oldSolution, Solution newSolution, DocumentId documentId, IAsyncToken asyncToken)
 {
     // document changed event is the special one.
     _eventProcessingQueue.ScheduleTask(
         () => EnqueueWorkItemAfterDiffAsync(oldSolution, newSolution, documentId), _shutdownToken).CompletesAsyncOperation(asyncToken);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:6,代码来源:WorkCoordinator.cs


示例9: With

 public WorkItem With(IAsyncToken asyncToken)
 {
     return new WorkItem(
         this.DocumentId, this.ProjectId, this.Language, this.InvocationReasons, this.IsLowPriority, this.ActiveMember, this.Analyzers,
         retry: false, asyncToken: asyncToken);
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:6,代码来源:WorkCoordinator.WorkItem.cs


示例10: ProcessEvents

            private void ProcessEvents(WorkspaceChangeEventArgs args, IAsyncToken asyncToken)
            {
                SolutionCrawlerLogger.LogWorkspaceEvent(_logAggregator, (int)args.Kind);

                // TODO: add telemetry that record how much it takes to process an event (max, min, average and etc)
                switch (args.Kind)
                {
                    case WorkspaceChangeKind.SolutionAdded:
                    case WorkspaceChangeKind.SolutionChanged:
                    case WorkspaceChangeKind.SolutionReloaded:
                    case WorkspaceChangeKind.SolutionRemoved:
                    case WorkspaceChangeKind.SolutionCleared:
                        ProcessSolutionEvent(args, asyncToken);
                        break;
                    case WorkspaceChangeKind.ProjectAdded:
                    case WorkspaceChangeKind.ProjectChanged:
                    case WorkspaceChangeKind.ProjectReloaded:
                    case WorkspaceChangeKind.ProjectRemoved:
                        ProcessProjectEvent(args, asyncToken);
                        break;
                    case WorkspaceChangeKind.DocumentAdded:
                    case WorkspaceChangeKind.DocumentReloaded:
                    case WorkspaceChangeKind.DocumentChanged:
                    case WorkspaceChangeKind.DocumentRemoved:
                    case WorkspaceChangeKind.AdditionalDocumentAdded:
                    case WorkspaceChangeKind.AdditionalDocumentRemoved:
                    case WorkspaceChangeKind.AdditionalDocumentChanged:
                    case WorkspaceChangeKind.AdditionalDocumentReloaded:
                        ProcessDocumentEvent(args, asyncToken);
                        break;
                    default:
                        throw ExceptionUtilities.Unreachable;
                }
            }
开发者ID:GloryChou,项目名称:roslyn,代码行数:34,代码来源:WorkCoordinator.cs


示例11: EnqueueEvent

 private void EnqueueEvent(Solution solution, InvocationReasons invocationReasons, IAsyncToken asyncToken)
 {
     var task = _eventProcessingQueue.ScheduleTask(
         () => EnqueueWorkItemForSolution(solution, invocationReasons), _shutdownToken).CompletesAsyncOperation(asyncToken);
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:5,代码来源:WorkCoordinator.cs


示例12: ProcessDocumentEvent

            private void ProcessDocumentEvent(WorkspaceChangeEventArgs e, IAsyncToken asyncToken)
            {
                switch (e.Kind)
                {
                    case WorkspaceChangeKind.DocumentAdded:
                        EnqueueEvent(e.NewSolution, e.DocumentId, InvocationReasons.DocumentAdded, asyncToken);
                        break;
                    case WorkspaceChangeKind.DocumentRemoved:
                        EnqueueEvent(e.OldSolution, e.DocumentId, InvocationReasons.DocumentRemoved, asyncToken);
                        break;
                    case WorkspaceChangeKind.DocumentReloaded:
                    case WorkspaceChangeKind.DocumentChanged:
                        EnqueueEvent(e.OldSolution, e.NewSolution, e.DocumentId, asyncToken);
                        break;

                    case WorkspaceChangeKind.AdditionalDocumentAdded:
                    case WorkspaceChangeKind.AdditionalDocumentRemoved:
                    case WorkspaceChangeKind.AdditionalDocumentChanged:
                    case WorkspaceChangeKind.AdditionalDocumentReloaded:
                        // If an additional file has changed we need to reanalyze the entire project.
                        EnqueueEvent(e.NewSolution, e.ProjectId, InvocationReasons.AdditionalDocumentChanged, asyncToken);
                        break;

                    default:
                        throw ExceptionUtilities.Unreachable;
                }
            }
开发者ID:GloryChou,项目名称:roslyn,代码行数:27,代码来源:WorkCoordinator.cs


示例13: ProcessSolutionEvent

 private void ProcessSolutionEvent(WorkspaceChangeEventArgs e, IAsyncToken asyncToken)
 {
     switch (e.Kind)
     {
         case WorkspaceChangeKind.SolutionAdded:
             OnSolutionAdded(e.NewSolution);
             EnqueueEvent(e.NewSolution, InvocationReasons.DocumentAdded, asyncToken);
             break;
         case WorkspaceChangeKind.SolutionRemoved:
             EnqueueEvent(e.OldSolution, InvocationReasons.SolutionRemoved, asyncToken);
             break;
         case WorkspaceChangeKind.SolutionCleared:
             EnqueueEvent(e.OldSolution, InvocationReasons.DocumentRemoved, asyncToken);
             break;
         case WorkspaceChangeKind.SolutionChanged:
         case WorkspaceChangeKind.SolutionReloaded:
             EnqueueEvent(e.OldSolution, e.NewSolution, asyncToken);
             break;
         default:
             throw ExceptionUtilities.Unreachable;
     }
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:22,代码来源:WorkCoordinator.cs


示例14: SynchronizePrimaryWorkspaceAsync

            protected override async Task ExecuteAsync()
            {
                lock (_gate)
                {
                    _lastToken?.Dispose();
                    _lastToken = null;
                }

                // wait for global operation to finish
                await GlobalOperationTask.ConfigureAwait(false);

                // update primary solution in remote host
                await SynchronizePrimaryWorkspaceAsync(_globalOperationCancellationSource.Token).ConfigureAwait(false);
            }
开发者ID:lachbaer,项目名称:roslyn,代码行数:14,代码来源:RemoteHostClientServiceFactory.SolutionChecksumUpdater.cs


示例15: UpdateSolutionChecksumAsync

            protected override async Task ExecuteAsync()
            {
                lock (_gate)
                {
                    _lastToken?.Dispose();
                    _lastToken = null;
                }

                // wait for global operation to finish
                await GlobalOperationTask.ConfigureAwait(false);

                // cancel updating solution checksum if a global operation (such as loading solution, building solution and etc) has started
                await UpdateSolutionChecksumAsync(_globalOperationCancellationSource.Token).ConfigureAwait(false);

                // check whether we had bulk change that require asset synchronization
                if (_synchronize)
                {
                    await SynchronizeAssets().ConfigureAwait(false);
                }
            }
开发者ID:TyOverby,项目名称:roslyn,代码行数:20,代码来源:RemoteHostClientServiceFactory.SolutionChecksumUpdater.cs


示例16: EnqueueChecksumUpdate

            private void EnqueueChecksumUpdate()
            {
                // event will raised sequencially. no concurrency on this handler
                if (_event.CurrentCount > 0)
                {
                    return;
                }

                lock (_gate)
                {
                    _lastToken = _lastToken ?? Listener.BeginAsyncOperation(nameof(SolutionChecksumUpdater));
                }

                _event.Release();
            }
开发者ID:TyOverby,项目名称:roslyn,代码行数:15,代码来源:RemoteHostClientServiceFactory.SolutionChecksumUpdater.cs



注:本文中的IAsyncToken类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IAsynchronousOperationListener类代码示例发布时间:2022-05-24
下一篇:
C# IAsyncResult类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap