Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

Multitasking problem

Hello,

I have modified Simple Socket Server example for my application where my processor is a client.

In this I am required to send and recv simultaneously. So in the beginning in CreateSocketTask, I create a socket and connect it to the server (After succesful connect, this task deletes itself). I have then two independent tasks: SendTask and RecvTask. In SendTask I periodically read data from a FIFO peripheral, format the data and send it. And In RecvTask, I can receive messages from the server. SendTask has higher priority then RecvTask. These two tasks are suspended before 'connect' and resume after 'connect' call.

I observed while SendTask executes properly, RecvTask is not executing at all. However, if I keep RecvTask at higher priority, it is only the RecvTask which executes and the SendTask appears redundant.

What could be the problem?

Sincerely,

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    In order for a lower priority task to get CPU time the higher priority task must have a OS Pend (OSFlagPend, OSMBoxPend etc...) or OSTimeDly() somewhere. Maybe the recv() and send() functions are non blocking and therefore do not suspend the task.

    I think you could use the select() function, which is blocking and uses the OS calls.