xTimerDelete

michaeln32 wrote on Tuesday, March 19, 2019:

Hi

I create a timer using xTimerCreate().

The timer will run only one time when it reached its expire time.

Can I delete the timer (using xTimerDelete()) in the call back of this timer ?

For example

void timer_call_back(void)
{
//code
//code
//code
xTimerDelete(timer_handler,10);
}

Michael

rtel wrote on Tuesday, March 19, 2019:

I think (?) it should be possible to delete a timer in its callback BUT
ONLY if you use a block time of 0. Your code sample is using a block
time of 10 which will cause a deadlock if the timer command queue is
full (timer callbacks run in the context of the timer task so if you
block to post to the timer queue there you are also blocking the task
that would otherwise make space in the same queue.