AnsweredAssumed Answered

MQX RTOS, Cortex M, task_create & task_destroy

Question asked by Roosbeh Almasi on Jan 18, 2018
Latest reply on Mar 21, 2018 by Daniel Chen

Hi everybody,

 

it is me again. this one might be a bit odd. but here it is:

I want to create a task inside a interrupt service routine of a GPIO whenever the interrupt request is raised. then the created task will do what it should and at the end gets destroyed. the GPIO interrupt will be raised by rising edge. 

so: 

1. IGPIO RQ is raised 

2. _task_create(taskId) inside the GPIO isr

3 task runs and do something

4. _task_destroy(taskId) after it has done it its job

 

the points: 

>> is is possible to destroy a task inside itself

>> how to avoid creating the same task again when the 2nd IRQ is raised while the task is still doing something. 

basically I want to discard any irq until the task finishes its job and gets destroyed. 

 

I know I can use event to block and those kind of things but want to do it specifically by creating and destroying in periodically. 

 

I thought maybe disable the GPIO irq right after creating the task and enable it when the task is done its job. is there a better way? 

Outcomes