How to Disable/Enable MQX task template?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Disable/Enable MQX task template?

798 Views
sivakumarananth
Contributor I

Dear friends,   In my project some template_task are running under round robin scheduling!!! (for ex: 10 tasks). if I want to stop/disable and resume/Enable some tasks like 5 & 6? how to do it?…

0 Kudos
4 Replies

444 Views
RadekS
NXP Employee
NXP Employee

For example:

_task_block() - Blocks the active task.

_task_ready() - Makes the task ready to run by putting it in its ready queue.

_task_restart() - Restarts the task.

or by any of other functions for synchronization, like Semaphores, Events, Mutexs, Message Queues.

For more details, please see MQX_User_Guide.pdf and MQX_Reference_Manual.pdf at c:\Freescale\Freescale_MQX_4_1\doc\mqx\

Very useful videos:

http://www.freescale.com/webapp/sps/site/training_information.jsp?code=WBT_MQX_RTOS_COURSE


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

444 Views
sivakumarananth
Contributor I

Good morn Radek s.

     Tnks fr ur immediate response. I have a doubt that out of 10 task running in FIFO(round robin) now the active task running is '3' and this point I want to hold/Disable task '8' and then after the tasks like 3, 4, 5 running and then I want to resume/enable '8' task. is it possible? when ever I need I want to pause/disable/hold some tasks and then resume. is it possible?

0 Kudos

444 Views
RadekS
NXP Employee
NXP Employee

I am afraid that it is not possible to directly block inactive task from active task. It could be dangerous.

Idea1: You can try play with _task_set_priority() command.

Idea2: You can use _sched_yield() function for switching between tasks in ready queue and after that use _task_block in some of tasks. You can use also _time_delay() when you want remove task from ready queue for some specific time.

Idea3: The best way is using synchronization objects like semaphores, events, mutexs and message queues … and rather their lightweight versions.

0 Kudos

444 Views
DavidS
NXP Employee
NXP Employee

Hi Siva,

I agree with Radek comments and suggestions.

Assumption:

- You are not setting up the 10 round robin tasks to use Time Slicing.  Is that correct?  If assumption correct then next assumption is you are using _sched_yield() or _time_delay() to block the round robin task to let the next task run.  Correct?

Additional suggestions:

- Assuming the _sched_yield() or _time_delay() is being used to block the running task, you might add in a lwevent structure to be used by all 10 round robin tasks.  Once the task becomes active it could use _lwevent_wait_until() to test for a event bit mask setting.  If the bit is set, then the task runs.  If the bit mask is not set, then the task will block until another task sets that bit mask.

Regards,

David

0 Kudos