当前位置: 首页 > 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.zqtcl.cn/news/429711/

相关文章:

  • 网站建设与维护理解视频当背景图片 网站开发
  • 站酷设计师网站wordpress 设置静态内容缓存时间
  • 网站推广做什么好看的电商网站模板下载
  • 如何打破违法网站wordpress 无法上传文件
  • 自己做网站的软件下载wordpress发布文章 更新失败
  • 电大企业网站建设论文范文搜狗推广登录入口
  • 建设银行u盾用网站打不开软件工程师证书有哪些
  • 网站建设域名的购买多少钱注册的公司才能参加投标
  • 做婚纱网站策划方案php网站超市源码
  • 济南网站搭建公司有哪些做企业网站的
  • 360做企业网站多少钱凡客诚品网
  • 效果好的徐州网站建设LAMP环境wordpress放在哪里
  • 考试类网站如何做什么是网络营销?有何特点
  • 网站制作公司哪家好wordpress插件怎么汉化
  • 南阳东莞网站建设公司网页升级访问狼在线观看
  • 备案的网站每年都要备案么东平县建设局网站
  • 做网站必须得ipc手机网站制作方法
  • 山东省建设监理协会网站打不开移动互联网开发实践
  • 南宁微网站制作需要多少钱小米商城网站开发文档
  • 制作销售网站有哪些如何制作个人网页设计
  • 新网站做内链智能网站推广软件
  • 西宁市住房和城乡建设局网站广州站是指哪个站
  • 帮建网站网页设计师考试内容
  • seo网站开发txt 发布 wordpress
  • 资讯门户类网站模板定制系统开发公司
  • 让网站快速收录初中毕业如何提升学历
  • 石家庄做网站价格seo优化效果
  • 为什么浏览器打开是2345网址导航seo免费资源大全
  • 网站工程是干啥的动态个人网页制作html教程
  • 阿里云多网站建设wordpress 统计分析