当前位置: 首页 > news >正文

苏州企业网站制作多少钱wordpress建站 网盘视频教程

苏州企业网站制作多少钱,wordpress建站 网盘视频教程,阿里云服务器学生优惠,礼品类网站建设策划方案通过计划程序策略#xff0c;可控制计划程序在管理任务时使用的策略。 本文演示如何使用计划程序策略来增加将进度指示器打印到控制台的任务的线程优先级。 示例 以下示例并行执行两个任务。 第一个任务计算第 n 个斐波那契数。 第二个任务将进度指示器打印到控制台。 第一…通过计划程序策略可控制计划程序在管理任务时使用的策略。 本文演示如何使用计划程序策略来增加将进度指示器打印到控制台的任务的线程优先级。 示例 以下示例并行执行两个任务。 第一个任务计算第 n 个斐波那契数。 第二个任务将进度指示器打印到控制台。 第一个任务使用递归分解来计算斐波那契数。 也就是说每个任务均以递归方式创建子任务来计算总体结果。 使用递归分解的任务可能会使用所有可用资源因而使其他任务无资源可用。 在此示例中打印进度指示器的任务可能无法及时访问计算资源。 为了向打印进度消息的任务提供对计算资源的公平访问此示例使用如何管理计划程序实例中所述的步骤来创建具有自定义策略的计划程序实例。 自定义策略将线程优先级指定为最高优先级类。 此示例使用 concurrency::call 和 concurrency::timer 类来打印进度指示器。 这些类具有其构造函数的版本这些构造函数引用了计划它们的 concurrency::Scheduler 对象。 该示例使用默认计划程序来计划计算斐波那契数的任务使用计划程序实例来计划打印进度指示器的任务。 为了说明使用具有自定义策略的计划程序的好处此示例执行整个任务两次。 本示例首先使用默认计划程序来计划这两个任务。 然后该示例使用默认计划程序来计划第一个任务使用具有自定义策略的计划程序来计划第二个任务。 // scheduler-policy.cpp // compile with: /EHsc #include windows.h #include ppl.h #include agents.h #include iostreamusing namespace concurrency; using namespace std;// Computes the nth Fibonacci number. // This function illustrates a lengthy operation and is therefore // not optimized for performance. int fibonacci(int n) {if (n 2)return n;// Compute the components in parallel.int n1, n2;parallel_invoke([n,n1] { n1 fibonacci(n-1); },[n,n2] { n2 fibonacci(n-2); });return n1 n2; }// Prints a progress indicator while computing the nth Fibonacci number. void fibonacci_with_progress(Scheduler progress_scheduler, int n) {// Use a task group to compute the Fibonacci number.// The tasks in this group are scheduled by the current scheduler.structured_task_group tasks;auto task make_task([n] {fibonacci(n);});tasks.run(task);// Create a call object that prints its input to the console.// This example uses the provided scheduler to schedule the // task that the call object performs.callwchar_t c(progress_scheduler, [](wchar_t c) { wcout c; });// Connect the call object to a timer object. The timer object// sends a progress message to the call object every 100 ms.// This example also uses the provided scheduler to schedule the // task that the timer object performs.timerwchar_t t(progress_scheduler, 100, L., c, true);t.start();// Wait for the task that computes the Fibonacci number to finish.tasks.wait();// Stop the timer.t.stop();wcout Ldone endl; }int wmain() { // Calculate the 38th Fibonacci number.const int n 38;// Use the default scheduler to schedule the progress indicator while // the Fibonacci number is calculated in the background.wcout LDefault scheduler: endl;fibonacci_with_progress(*CurrentScheduler::Get(), n);// Now use a scheduler that has a custom policy for the progress indicator.// The custom policy specifies the thread priority to the highest // priority class.SchedulerPolicy policy(1, ContextPriority, THREAD_PRIORITY_HIGHEST);Scheduler* scheduler Scheduler::Create(policy);// Register to be notified when the scheduler shuts down.HANDLE hShutdownEvent CreateEvent(NULL, FALSE, FALSE, NULL);scheduler-RegisterShutdownEvent(hShutdownEvent);wcout LScheduler that has a custom policy: endl;fibonacci_with_progress(*scheduler, n);// Release the final reference to the scheduler. This causes the scheduler// to shut down.scheduler-Release();// Wait for the scheduler to shut down and destroy itself.WaitForSingleObject(hShutdownEvent, INFINITE);// Close the event handle.CloseHandle(hShutdownEvent); } 输出如下: Default scheduler: ...........................................................................done Scheduler that has a custom policy: ...........................................................................done 编译代码 复制示例代码并将它粘贴到 Visual Studio 项目中或粘贴到名为 scheduler-policy.cpp 的文件中再在 Visual Studio 命令提示符窗口中运行以下命令。 cl.exe/EHsc scheduler-policy.cpp
http://www.dnsts.com.cn/news/209289.html

相关文章:

  • 腾讯云建站流程网站建设怎么说服客户
  • 网站建设合同要上印花税吗wordpress 动态图形
  • 网站建设一年多少恰网页设计创意书
  • 浙江苏省城乡建设厅网站网站开发框架排行
  • 无锡网络公司无锡网站推广网易免费企业邮箱登录入口
  • 网站后台管理系统制作网站做的好的公司有
  • 邦利博客网站怎么做的手机版网站打开速度慢
  • 怎么建立一个公司的网站吗wordpress如何调用文章页到首页
  • 综合返利商城网站建设长春网络公司十大排名
  • 淮安网站建设 淮安网站制作深圳广告网站设计制作
  • 国外做家谱的网站网络营销课程实训报告
  • 珠海网站公司哪家好opencart做网站视频
  • 东莞大岭山建网站公司免费自助建站哪家好
  • 四川建设学网官方网站登录管理系统网站模板
  • 蜘蛛云建网站怎样wordpress help
  • 广州网站建设 八爪鱼河北城乡建设厅网站
  • 优秀网站作品下载东莞三合一网站制作
  • 营销管理网站制作抖音代运营策划案
  • 建设项目自主验收公示网站郑州网站推广价格
  • 那个网站专做地质基础信息欢迎访问建设银行网站
  • 网站建设电浙江建设招生网站
  • 智能化网站建设包头建设安全协会网站
  • 参加网站建设项目人员保障体系微信微网站是什么案例
  • dz论坛怎么做视频网站吗上海广告制作公司
  • 网站开发学校 优帮云高明网站建设报价
  • 大图做网站背景加载慢北京12345网上投诉平台
  • 个人网站不能做淘宝客这个网站最近运转怎么样?安全性怎么样? 另外建设银行的网银能在这里存取款吗?
  • 手机网站弹窗网上怎么样挣钱
  • 珠海品牌机械网站建设网站在建设中 英语
  • 正能量网站ip广东蕉岭县建设局网站