_task_create() returns null

cancel
Showing results for 
Search instead for 
Did you mean: 

_task_create() returns null

555 Views
VinceTF
Contributor III

Device: mcf52258

MQX version: 3.8.1

Compilier: CW Eclipse 10.2

My application has 15 tasks.  For about a year all the tasks have been getting created without any issues that I can observe.

For no reason that I can see, the last task to be created is returning 0 when _task_create() is called.  I verified thread priorities, and there are no duplicates.

What can I do to determine why the last task is not getting created?

-Vince

Tags (3)
3 Replies

122 Views
BielikM
Contributor III

Hi Vincent,

Maybe you doesn't have enough stack for creating tasks. Try to check TAD (task aware debugging) in cw10.2 IDE or try to made stacks of your tasks smaller.

Regards,

Martin

122 Views
VinceTF
Contributor III

_task_get_error() returned code 4 which is MQX_OUT_OF_MEMORY.  I reduced the size of the stack for the task that was returning the error and everything works now.

Thanks to both of you for your quick response and your help.  I feel both of your responses are correct, but the forum only allows one to be selected as correct.

122 Views
c0170
Senior Contributor III

Hello Vincent Gagliardo,

please look at the code in mqx/source/kernel/task.c where it's _task_create_internal function. This one is invoked inside _task_create.

You'll see all possible returns with MQX_NULL_TASK_ID.

Snippet from MQX reference manual:

Traits

• If the child is on another processor, blocks the creator until the child is created

• On failure, calls _task_set_error() to set the task error code (see task error codes)

• For _task_create():

— If the child is on the same processor, preempts the creator if the child is a higher priority


Have you checked task error code ? Once you solve your problem, share it with the community. ThX.

Regards,

c0170