Idle waiting??
Brought to you by:
derenick
If the baud rate is set to 500K and the following piece of code is executed:
int i = 0;
while(1)
{
if(i == 0)
{
sick_lms.GetSickScan(values,num_values);
i++;
}
sleep(1);
}
Then, given that GetSickScan is just called once, the application should not waste CPU at all, because the while loop is sleeping. However, using the "top" command line tool (showing threads), it can be seen that a thread is created and it actually is spending 18% CPU constantly. How can that be fixed? I have tried to profile the code and the most deep I can get is that the problem in the SickLMSBufferMonitor::GetNextMessageFromDataStream.
Application code and "top" screenshot