vTimerCreate

michaeln32 wrote on Monday, June 25, 2018:

Hi,
If the system created only one timer (using vTimerCreate).

Along the running of the system - Can only one task use this timer or many tasks can use it ?

Thank you

richard_damon wrote on Monday, June 25, 2018:

A Timer is not tied to a specific task, so many tasks can use (start/stop/reset/etc) the timer, but a timer can only have a single time period/timeout time at any given time, so it can only be running once at any given time, and the timeout callback runs in the context of the Timer Task, not any particular task,

michaeln32 wrote on Monday, June 25, 2018:

Thank you Richard.

What happend if Task1 use timerA to run call back with timeout of 500 milli seconds
and after 100 milli Task2 do stop command to TimerA ?

Is the call back will run or not ?

richard_damon wrote on Monday, June 25, 2018:

If the last action on TimerA was ANY task (or ISR) doing a stop, then the timer is stopped, and the callback won’t be called until some task (or ISR) restarts it.
As I said, Timers are NOT connected to a task and have no knowledge of the tasks using them (unless YOU add such information for YOUR use in the timer tag).

michaeln32 wrote on Monday, June 25, 2018:

When task send command to timer service message Q - it causes the timer service task to move from block state to running state and process the command.

What can be more other situations that can cause the timer service task to move from block state to running state ?

rtel wrote on Monday, June 25, 2018:

What happend if TaskA use timerA to run call back with timeout of 500
milli seconds
and after 100 milli Task2 do stop command to TimerA ?

Is the call back will run or not ?

I strongly recommend that you read the documentation and experiment with
the code. In relation to this specific question - setting up a quick
and dirty test, observing the behaviour, and stepping through the code,
would give you the answer very quickly and teach you a lot about how the
code functions.