oops, sorry. bad post.
i'm actually using a idle time message loop
Code:
while(!done)
{
if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if ( msg.message == WM_QUIT )
done = TRUE;
else
{
GetMessage(&msg, NULL, 0, 0);
if(!IsDialogMessage(hStatusDlg, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
else
{
//wait until the worker thread pauses itself, then upload the star positions to the graphics card
if(threadLink == PAUSE)
{
//note the the directX visualiser is cpu efficient - this memcpy and the buffer filling above is almost
//the only load put on the cpu by the vis
//give the data to the visualiser
visualiser.Update(visBuffer);
//have the visualiser render
visualiser.Render();
threadLink = ITERATE; //tell the worker thread to resume
}
SendMessage(hStatusDlg, UM_UPDATE, 0, 0);
Sleep(0); //surrender the rest of the timeslice after one iteration, so that the app (and rest of the system)
//still respond to the user
}
}
(its an n-body spiral galaxy evolution simulation, hence the references to stars and directX visualisations)