<?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>MQX Software SolutionsのトピックRe: MQX 3.7 Proper Task Create-Destroy Method</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-3-7-Proper-Task-Create-Destroy-Method/m-p/197569#M4181</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tim562,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Answers to your questions,&lt;/P&gt;&lt;P&gt;1. It is proper to call call_task_destroy or simple return from the function and it will be destroyed.&lt;/P&gt;&lt;P&gt;2. _task_destroy(MQX_NULL_TASK_ID)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MartinK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Jan 2012 18:10:06 GMT</pubDate>
    <dc:creator>c0170</dc:creator>
    <dc:date>2012-01-13T18:10:06Z</dc:date>
    <item>
      <title>MQX 3.7 Proper Task Create-Destroy Method</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-3-7-Proper-Task-Create-Destroy-Method/m-p/197568#M4180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I'm pretty new to MQX and would like to confirm that I have the right idea when it comes to dynamically creating and destroying tasks to perform transitory jobs that might be blocking in nature (or require a lot of time to complete).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 1: Is it proper to call _task_destroy() from within the child Task function I want to destroy (as in code example below)&amp;nbsp;or do I need to do this from the parent function that created the task?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 2: If allowed to call _task_destroy() from within the child task I want to terminate, which is the better/proper way to do it: _task_destroy(_task_get_id()); or _task_destroy(MQX_NULL_TASK_ID); ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This simplified&amp;nbsp;example code seems to work as I intend I would just like to confirm that I'm doing things the "MQX" way, Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;TASK_TEMPLATE_STRUCT MQX_template_list[] ={/*Task number, EntryPoint, Stack, Pri, String, Auto?                */  {MAIN_TASK,  MAIN_task,  5000,  9,   "main",  MQX_AUTO_START_TASK},  {TEMP_TASK,  My_Task,    5000,  9,   "mtask", 0},  {0,          0,          0,     0,    0,      0}};void MAIN_task(uint_32 initial_data)   {   boolean bNeedTask = 0;   _task_id tiNewTaskID;   if(bNeed_Task == 1)      {      tiNewTaskID = _task_create(0, TEMP_TASK, 0);      if(tiNewTaskID == MQX_NULL_TASK_ID)         {         //Log Error...         }      bNeed_Task = 0;      }// Do Stuff Here....   }void my_task(uint_32 initial_data)   {   //Do something here....   _task_destroy( _task_get_id() ); //Which way is better/proper??// _task_destroy(MQX_NULL_TASK_ID); //   return;   }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2012 06:27:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-3-7-Proper-Task-Create-Destroy-Method/m-p/197568#M4180</guid>
      <dc:creator>Tim562</dc:creator>
      <dc:date>2012-01-13T06:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: MQX 3.7 Proper Task Create-Destroy Method</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-3-7-Proper-Task-Create-Destroy-Method/m-p/197569#M4181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tim562,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Answers to your questions,&lt;/P&gt;&lt;P&gt;1. It is proper to call call_task_destroy or simple return from the function and it will be destroyed.&lt;/P&gt;&lt;P&gt;2. _task_destroy(MQX_NULL_TASK_ID)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MartinK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2012 18:10:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-3-7-Proper-Task-Create-Destroy-Method/m-p/197569#M4181</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2012-01-13T18:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: MQX 3.7 Proper Task Create-Destroy Method</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-3-7-Proper-Task-Create-Destroy-Method/m-p/197570#M4182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Kojto, I appreciate your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;~Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Jan 2012 00:57:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-3-7-Proper-Task-Create-Destroy-Method/m-p/197570#M4182</guid>
      <dc:creator>Tim562</dc:creator>
      <dc:date>2012-01-14T00:57:49Z</dc:date>
    </item>
  </channel>
</rss>

