AnsweredAssumed Answered

Unblocking a Task that has blocked itself by calling _task_block()

Question asked by Tim Hutchinson on Jul 9, 2013
Latest reply on Jul 10, 2013 by Tim Hutchinson

Hi All,


I'm trying to get a service Task to run periodically (at priority 9), so I've created the task in my main task (priority 10) like this:

_task_id tiNewTaskID;

tiNewTaskID= _task_create_blocked(0, gcFSERVE_TASK, 0);


Then, in a timer ISR I unblock the task and make it ready like this:

_task_ready( _task_get_td(tiNewTaskID) );


Once the service task completes it blocks again like this:



The problem I'm having is that the service task only unblocks and runs once (the first time the timer ISR sets it ready). Once the service Task calls _task_block() and blocks itself it never runs again. Am I doing something wrong here? Perhaps this isn't the proper way to have a task run periodically by a timer ISR? By the way, I can make this work if I create a new Task each time the timer ISR fires and have the service Task destroy itself when it's finished. It just seems like the wrong way to go about it. The processor being used is the MPC-5125 with MQX 3.8.0 RTOS. Any ideas? Thanks!