Hi all,
I am working on a C++ application which involves a thread. My application draws the waveform on screen. The drawing speed should be 25mm/s and the thread should run every 10.56ms for this speed to obtain.
But with either 10ms or 11ms set as the Time period for the periodic thread, i am not able to get the exact drawing speed of 25mm/s. Its 26.41mm/s for 10ms and 24.04 for 11ms. So Error of more than 4% which is not acceptable.
/* Main Thread routine handling the waveform draw */
DWORD virtual CntrlThread()
{
while(true)
{
if(TRUE == WaitForSignal())
{
if(this->m_bStopThr == false)
{
//Sleep(m_pWaveform->m_i32SampleInterval);
if(!m_pWaveform->m_bPaused)
{
/* Waveform drawn in Green color */
m_pWaveform->DrawWave();
}
if(m_pWaveform->m_vRequestQueue.size() > 0U)
{
/* Waveform Request handler */
m_pWaveform->UserRequestHandler();
}
}
else
{
break;
}
}
else
{
break;
}
}
return THR_STATE_COMPLETED;
}
Please let me know what can be the possible resolutions to get the exact drawing speed.