c++后台更新
C++ background update
如何在后台调用更新函数?我需要每5秒更新一次集合
在c#中,我创建了定时器set start stop and delegate,它可以工作。
在c++中是否存在?
c++ 11:
#include <thread>
void update() {
for (;;) {
do_update();
this_thread::sleep_for(std::chrono::seconds(5));
}
}
int main() {
std::thread thr(update);
thr.detach();
// do whatever the program needs to do
return 0;
}
在我们的嵌入式系统上,我们创建了一个在后台运行的单独任务。另一种方法是通过中断完成大部分工作,非中断代码将在后台运行。
我猜这是平台相关的,你用的是哪个平台?
相关文章:
- 从C++本机插件更新Vector3数组
- QGraphicsPolygonItem在拖动时未更新QPolygonF坐标
- cmake更新缓存的变量
- 更新到莫哈韦后出现cmath错误
- OpenMP:并行更新数组总是需要减少数组吗
- 为什么我的变量没有更新,我的 LED 没有亮起?
- 指针没有更新它在void函数内部指向的值
- 如何在c++中获取要更新的值
- 已修改的LinkedList未在文本文件本身中更新
- Qt:当QListView获得新条目时,如何更新QStringList
- 更新的矢量元素不打印
- 如何使用按钮更新GTK3图像以使用C++从相机捕获图片
- 如何在ECS框架中更新组件数据和通知系统
- 从VS 2015更新3更新到VS2015更新3 d后浮点计算行为不同的原因
- 如果我想在没有更新编译器的情况下使用新功能,该怎么办?
- 使用委托从后台任务更新 UI
- 在后台阅读文件以更新QJSONVALUE
- 在Qt中从后台更新UI(QtConcurrent)
- 运行后台"algrothim"更新小部件Qt的最佳方式
- c++后台更新