I am a newbie writing code for sound playback via “alsa api”.
I have to repeatedly call a function send_output() 10 times in a sec as:
while(true)
{
send_output();
usleep(100000);
}
but this is a bad way of programming since within the usleep() function processor is still busy executing the code.
I want to know the way (for I know it exists) to put the function send_output() into a periodic callback function so that in between the calls, the processor can be kept free for other heavy tasks. Can you help me?
P.S. I am programming on ‘Beagleboard’ which has a very low clock rate and need to do other tasks too.
Thanks.
man usleep