Parallel threads

Hello,

i‘m trying to emulate parallel thread execution to send and receive messages simultaneously in my application. I have two threads. The main thread with priority 7. It creates and sends messages in while loop with gnrc_netapi_send() function. The second receiver thread has priority 6 and receives messages in while loop with function msg_receive(). When the application running, there is no context switch. There are only messages sent from the first thread, or only messages received from the second thread, depending on what starts first. Currently I solved the problem by calling xtimer_sleep() function after after gnrc_netapi_send(). Is there a better solution to achieve the parallel execution emulation? Would be glad about any advice. Thank You in advance!

Best regards, Janna

Hi Janna,

i�m trying to emulate parallel thread execution to send and receive messages simultaneously in my application.

which board are you using?

I have two threads. The main thread with priority 7. It creates and sends messages in while loop with gnrc_netapi_send() function. The second receiver thread has priority 6 and receives messages in while loop with function msg_receive(). When the application running, there is no context switch. There are only messages sent from the first thread, or only messages received from the second thread, depending on what starts first. Currently I solved the problem by calling xtimer_sleep() function after after gnrc_netapi_send(). Is there a better solution to achieve the parallel execution emulation?

Hard to debug without seeing the code. Would you be able to share the relevant parts?

Kaspar