need to call a function at periodic time intervals in c++

前端 未结 8 1122
悲&欢浪女
悲&欢浪女 2020-11-30 08:58

I am writing a program in c++ where I need to call a function at periodic time intervals, say every 10ms or so. I\'ve never done anything related to time or clocks in c++, i

8条回答
  •  伪装坚强ぢ
    2020-11-30 09:13

    I made myself an async system. It should not be confused with std::async. Since it is custom made, I have full control over the timeline, so I can add, edit, remove, append, etc tasks. Mainly it runs in a single thread and guarantees safety between context switches, but also has support for multi-thread syncing. Try to make your own async system, from my experience I would say it's worth it

提交回复
热议问题