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:
If you are using Qt, here is a simple way to do this:
QTimer* t = new QTimer( parent ) ; t->setInterval( 30 ) ; // in msec t->setSingleShot( false ) ; connect( t, SIGNAL( timeout() ), viewPort, SLOT( redraw() ) ) ;
You'll need to specify viewPort and redraw(). Then start the timer with t->start().
viewPort
redraw()
t->start()