<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic MQX question: _task_create with the same task multiple times? in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-question-task-create-with-the-same-task-multiple-times/m-p/1244343#M18622</link>
    <description>&lt;P&gt;I am developing with MQX RTOS using MQX 5.0, and I have a question regarding the creation of tasks.&lt;/P&gt;&lt;P&gt;I've gotten to the point that can start tasks by filling out a&amp;nbsp;TASK_TEMPLATE_STRUCT MQX_template_list[] array with the following:&lt;/P&gt;&lt;P&gt;{ Task Index, Function, Stack, Priority, Name, Attributes, Param, Time Slice }&lt;/P&gt;&lt;P&gt;followed by officially creating the task with the following call:&lt;/P&gt;&lt;P&gt;_task_create(0, Task Index, param); // send param to the task to control which data the task works on.&lt;/P&gt;&lt;P&gt;I've found that it is possible to call task_create with the same task index multiple times. This is desirable for the application I'm working on... and it the application seems to run OK so far.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any downside to creating tasks this way? I've put code around this to limit the creation of "duplicate tasks" to 20.&lt;/P&gt;&lt;P&gt;The one obvious thing I can think of is that I need to consider the allocation "Stack" to be 20x if all 20 were duplicates were required at the same time.&lt;/P&gt;&lt;P&gt;Obviously I've left out some of the implementation details of what the function is doing... but param changes what data the task (or duplicate tasks) are working on, with a variable _time_delay() in each task (determined by the data the task is working on).&lt;/P&gt;&lt;P&gt;If further clarification is needed to answer this question, let me know.&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Mar 2021 19:00:54 GMT</pubDate>
    <dc:creator>jbaker1</dc:creator>
    <dc:date>2021-03-11T19:00:54Z</dc:date>
    <item>
      <title>MQX question: _task_create with the same task multiple times?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-question-task-create-with-the-same-task-multiple-times/m-p/1244343#M18622</link>
      <description>&lt;P&gt;I am developing with MQX RTOS using MQX 5.0, and I have a question regarding the creation of tasks.&lt;/P&gt;&lt;P&gt;I've gotten to the point that can start tasks by filling out a&amp;nbsp;TASK_TEMPLATE_STRUCT MQX_template_list[] array with the following:&lt;/P&gt;&lt;P&gt;{ Task Index, Function, Stack, Priority, Name, Attributes, Param, Time Slice }&lt;/P&gt;&lt;P&gt;followed by officially creating the task with the following call:&lt;/P&gt;&lt;P&gt;_task_create(0, Task Index, param); // send param to the task to control which data the task works on.&lt;/P&gt;&lt;P&gt;I've found that it is possible to call task_create with the same task index multiple times. This is desirable for the application I'm working on... and it the application seems to run OK so far.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any downside to creating tasks this way? I've put code around this to limit the creation of "duplicate tasks" to 20.&lt;/P&gt;&lt;P&gt;The one obvious thing I can think of is that I need to consider the allocation "Stack" to be 20x if all 20 were duplicates were required at the same time.&lt;/P&gt;&lt;P&gt;Obviously I've left out some of the implementation details of what the function is doing... but param changes what data the task (or duplicate tasks) are working on, with a variable _time_delay() in each task (determined by the data the task is working on).&lt;/P&gt;&lt;P&gt;If further clarification is needed to answer this question, let me know.&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 19:00:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-question-task-create-with-the-same-task-multiple-times/m-p/1244343#M18622</guid>
      <dc:creator>jbaker1</dc:creator>
      <dc:date>2021-03-11T19:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: MQX question: _task_create with the same task multiple times?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-question-task-create-with-the-same-task-multiple-times/m-p/1249469#M18623</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/119732"&gt;@jbaker1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From what I can see from the code, if you&amp;nbsp; use _task_create multiple times, then all the tasks have the same priority, and same stack size, same index, maybe those are not you want.&lt;/P&gt;
&lt;P&gt;It is hard to debug since they have the same index.&lt;/P&gt;
&lt;P&gt;So I would suggest you create multiple tasks with different index.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 08:12:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-question-task-create-with-the-same-task-multiple-times/m-p/1249469#M18623</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2021-03-22T08:12:42Z</dc:date>
    </item>
  </channel>
</rss>

