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

高校网站建设汇报百度seo还有前景吗

高校网站建设汇报,百度seo还有前景吗,网站建设和管理培训,镇江seo方案异步实现的一些方式 事件循环实现回调函数实现 其实主要就是用到std::future和std::async这些#xff0c;记录一下异步耗时操作是否结束 事件循环实现 其实主要就是这一行代码 std::futureint fut std::async(std::launch::async, async_operation);#includei… 异步实现的一些方式 事件循环实现回调函数实现 其实主要就是用到std::future和std::async这些记录一下异步耗时操作是否结束 事件循环实现 其实主要就是这一行代码 std::futureint fut std::async(std::launch::async, async_operation);#includeiostream #includefuture #includethread #includechrono #includecondition_variable #includemutex// 事件循环实现异步 int async_operation() {// 模拟耗时操作,sleep 5sstd::this_thread::sleep_for(std::chrono::seconds(5));return 42; }void on_result(int result) {std::cout Result of the async operation: result std::endl; }int main() {// 使用std::async启动异步操作std::futureint fut std::async(std::launch::async, async_operation);// 在主线程中输出一条消息表明异步操作已开始std::cout Async operation started. std::endl;// 使用事件循环检查异步操作是否已完成while (true) {// 表示最多等待100ms如果异步操作完成了返回std::future_status::ready否则返回std::future_status::timeoutstd::future_status status fut.wait_for(std::chrono::milliseconds(100));if (status std::future_status::ready) {// 异步操作已完成获取结果并调用回调函数int result fut.get();on_result(result);break;}// 在这里执行其他任务例如处理用户输入、更新UI等std::this_thread::sleep_for(std::chrono::milliseconds(100));}return 0; }回调函数实现 #include chrono #include condition_variable #include future #include iostream #include mutex #include thread// 回调实现异步2-2是不采用匿名表达式的方式 int async_operation() {// 模拟耗时操作std::this_thread::sleep_for(std::chrono::seconds(5));return 42; }void on_result(int result) {std::cout Result of the async operation: result std::endl; }void async_callback(std::functionvoid(int) callback) {// 启动一个新线程来执行异步操作std::thread t([callback]() {int result async_operation();callback(result); // 调用回调函数});// 分离线程使主线程不再等待它完成t.detach(); }int main() {// 在主线程中输出一条消息表明异步操作已开始std::cout Async operation started. std::endl;// 使用回调函数启动异步操作async_callback(on_result);while (true) {// 在这里执行其他任务例如处理用户输入、更新UI等std::cout 处理其他任务1 std::endl;std::this_thread::sleep_for(std::chrono::seconds(1));std::cout 处理其他任务2 std::endl;}return 0; }
http://www.pierceye.com/news/429711/

相关文章:

  • ps制作网站logo广西建设局网站
  • 专业网站建设公司排名wordpress上传媒体文件大小修改
  • 郑州app开发公司排名网站seo 文章转载 修改标题
  • 深圳网站备案查询成都建设施工安全协会网站
  • 做视频找素材的网站有哪些邢台做网站多少钱
  • 创世网站建设公司设计理念页面设计
  • 免费的网站模板昆明装饰企业网络推广
  • 怎样用微信做购物网站广州菜谱制作公司
  • 视频网站发展好应该怎么做wordpress移动支付免费
  • 青岛网站设计案例wordpress 转换成小程序
  • 展览中心网站建设优质的成都网站建设推
  • 建材网站模板济南建设集团网站
  • 合肥市建设建筑网站wordpress医院主题
  • 做ui要上那些网站完全免费网站源码
  • 集团企业网站建设建立网站有哪些步骤
  • 如何做自己的网站整合营销和链路营销
  • 外贸网站的公司介绍响应式布局代码例子
  • 校园网站的意义保定建设厅网站
  • 网站域名注册后怎么打开网站ip安装wordpress
  • 山西太原做网站网站开发上线流程
  • 江门网站建设多少钱网页服务器一年多少钱
  • 网站开发属于什么行业农商网站建设个人总结
  • 网站建设业务开展方案昆明市城市基本建设档案馆网站
  • 湖南网站托管做招聘网站排名
  • 主机屋免费网站空间网站建设安全标准
  • .net cms网站管理系统生态养殖网站模板
  • 国外网站一般公司网站是什么设计师做
  • 备案停止网站网站建设研究课题
  • 个人网站开发是学什么语言网站建设 总体思路
  • 网站怎么留住用户在什么地方可以接到做网站的活