What is the best way to exit out of a loop after an elapsed time of 30ms in C++

后端 未结 9 1005
感动是毒
感动是毒 2020-12-11 13:24

What is the best way to exit out of a loop as close to 30ms as possible in C++. Polling boost:microsec_clock ? Polling QTime ? Something else?

Something like:

9条回答
  •  死守一世寂寞
    2020-12-11 14:12

    While this does not answer the question, it might give another look at the solution. What about placing the simulation code and user interface in different threads? If you use Qt, periodic update can be realized using a timer or even QThread::msleep(). You can adapt the threaded Mandelbrot example to suit your need.

提交回复
热议问题