<?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: Unblocking a Task that has blocked itself by calling _task_block()</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unblocking-a-Task-that-has-blocked-itself-by-calling-task-block/m-p/262448#M7831</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, as usual, the problem was not what it appeared to be (not with a task at all). The service function call that represents the entry point for the MQX service task was written to return after doing what it needed to do! Since the task function had completed and exited there was no task to unblock (dooouh... ). I feel pretty silly but the obvious fix was just to have the service function do it's chores in an endless while() loop that blocks at the end of the loop. Some days your the bat and some days.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jul 2013 20:51:28 GMT</pubDate>
    <dc:creator>Tim562</dc:creator>
    <dc:date>2013-07-10T20:51:28Z</dc:date>
    <item>
      <title>Unblocking a Task that has blocked itself by calling _task_block()</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unblocking-a-Task-that-has-blocked-itself-by-calling-task-block/m-p/262447#M7830</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;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: courier new,courier;"&gt;_task_id tiNewTaskID;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: courier new,courier;"&gt;tiNewTaskID= _task_create_blocked(0, gcFSERVE_TASK, 0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, in a timer ISR I unblock the task and make it ready like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: courier new,courier;"&gt;_task_ready( _task_get_td(tiNewTaskID) );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once the service task completes it blocks again like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: courier new,courier;"&gt;_task_block();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I'm having is that &lt;SPAN style="text-decoration: underline;"&gt;the service task only unblocks and runs once&lt;/SPAN&gt; (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!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 00:07:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Unblocking-a-Task-that-has-blocked-itself-by-calling-task-block/m-p/262447#M7830</guid>
      <dc:creator>Tim562</dc:creator>
      <dc:date>2013-07-10T00:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: Unblocking a Task that has blocked itself by calling _task_block()</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Unblocking-a-Task-that-has-blocked-itself-by-calling-task-block/m-p/262448#M7831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, as usual, the problem was not what it appeared to be (not with a task at all). The service function call that represents the entry point for the MQX service task was written to return after doing what it needed to do! Since the task function had completed and exited there was no task to unblock (dooouh... ). I feel pretty silly but the obvious fix was just to have the service function do it's chores in an endless while() loop that blocks at the end of the loop. Some days your the bat and some days.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 20:51:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Unblocking-a-Task-that-has-blocked-itself-by-calling-task-block/m-p/262448#M7831</guid>
      <dc:creator>Tim562</dc:creator>
      <dc:date>2013-07-10T20:51:28Z</dc:date>
    </item>
  </channel>
</rss>

