Author Topic: task  (Read 13337 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
task
« on: February 02, 2009, 07:38:55 AM »
Hi Mark,
  I am using a maxim RTC that creates a 1Hz interrupt to the processor through an IRQ input. Within the interupt service routine I call a task, as so:
   fnInterruptMessage(TASK_SECONDIRQ, SECOND_EVENT);

What happens if a task (not necessary just the second task), is already half way through being processed when the fnInterruptMessage() is called? Is it placed pending, or simply doesnt get called?

Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3240
    • View Profile
    • uTasker
Re: task
« Reply #1 on: February 02, 2009, 10:56:43 AM »
Hi Neil

Code: [Select]
fnInterruptMessage() places an input event into the input queue of the destination task.
This means that the task will be flagged as needing to run so that it can respond to the input event.
If the task is not presently being processed it will be scheduled as soon as possible.
If the task is presently being scheduled it will either read the event from its queue (during handling of while ( fnRead( PortIDInternal, ucInputMessage, HEADER_LENGTH )) { }) or else it will complete and immediately re-enter when it is scheduled again (it will still be flagged as needing to run when leaving the first time).

This means that it will always respond to an interrupt event and these will never be lost.

Regards

Mark