I have a c function & it has to be completed in 10ms. If not it should stop executing & return error.
One way is to set a flag in ISR of timer & when it get set should get out of code. But main problem in this that I have to repeatedly check that flag in the function.
Is there any method that if error occur function should exit & return error, without checking that flag many time.
Like
void func(void)
{
alarm(10);
//.....statements
//.....statements
//.....statements
//.....statements
}