Creating multiple tasks with same priority

Hello all,

I am creating 3 infinite loop tasks that call the same function to connect to a tcp server port via lwip, when a successful connection is made it creates 2 further tasks. I can connect to all 3 ports but after I disconnect from all three and successfully reconnect to 1 it seems that the other 2 port tasks sometimes don’t work, as if they were not included in the task scheduler, sometimes they do work and sometimes only one other port works. Any clues, I assume this might have to do with task priorities and so forth. Any help is greatly appreciated. This application is executed on a Zynq device.

the server may not allow multiple connections in parallel. Did you check on that possibility?

Yes I did check for this possibility, as a matter of fact it seems that when the application is fresh connection to the 3 ports is possible, but once these connection are closed and any of the 3 ports are reconnected to there is a chance that the other 2s tasks are somehow de prioritized.

what makes you think that? Where exactly are the tasks suspended on?

The (intended ;-; ) functionality of the application is to poll the connection to the ports, on a connection a sort of transmit task is created, when this transmit task gets a tcp close it terminates the connection and its own task, and the polling task immediately polls for a connection again, this is true for each port. However after all 3 ports are connected to (first try is successful) any successful attempt to reconnect to any of the ports causes all or one or none of the other polling tasks to not execute. This makes me think the other 2 polling tasks get suspended somehow and even this is only sometimes.

well you already wrote all of that, so repititur non placent. Publish your code and/or let us know why you think that your tasks 2&3 get deprioritized - they may simply be suspended, eg on a connect or a read and do not get woken up.

1 Like

Its hard to follow your description. Please share the code.

1 Like

Thanks for the response as always a newby mistake, xil_printf was in the connection function and this messed with the loops, got rid of it and application worked as intended.

Thank you for sharing your solution!

1 Like