Run codes for only 60 times each second
<p>I'm creating a directx application that relies on the system time (because it must be accurate),
and I need to run lines of code for 60 times each second in the background (in a thread created by boost::thread). that's equal to 60 FPS (frame per second), but without depending on the main application frame rate.</p>

<pre><code>//.................
void frameThread()
{
    // I want to run codes inside this loop for *exactly* 60 times in a second.
    // In other words, every 16.67 (1000/60) milliseconds
    for(;;)
    {
      DoWork();
      //.........
    }
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
   initialize();
   //.....stuffs
   boost::thread framethread(frameThread);
   //......
}
</code></pre>

<p>Is there a way to do this?</p>

<p>Any kind of help would be appreciated :)</p>
