c + +升压ASIO简单的周期性计时器? [英] C++ Boost ASIO simple periodic timer?

查看:208
本文介绍了c + +升压ASIO简单的周期性计时器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个很简单的周期定时器打电话给我code每隔50ms。我能有这样的休眠50ms的所有的时间一个线程(但是这是一个痛苦)...我可以开始寻找进入Linux API的制作定时器(但它不是便携式)...

I want a very simple periodic timer to call my code every 50ms. I could make a thread that sleeps for 50ms all the time (but that's a pain)... I could start looking into Linux API's for making timers (but it's not portable)...

我想的的使用boost。我只是不知道这是可能的。升压是否提供此功能?

I'd like to use boost.. I'm just not sure it's possible. Does boost provide this functionality?

推荐答案

在队内第二个例子短耳教程解释它。结果
你可以找到它的here.

The second example on Boosts Asio tutorials explains it.
You can find it here.

之后,检查第三个例子来看看你怎么可以用周期性时间INTERVALL再次调用它

After that, check the 3rd example to see how you can call it again with a periodic time intervall

这篇关于c + +升压ASIO简单的周期性计时器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆