lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] LwIP 1.3.1 - Using tcp_write() outside of 'rawapi' call


From: Brian McFarland
Subject: Re: [lwip-users] LwIP 1.3.1 - Using tcp_write() outside of 'rawapi' callback context?
Date: Fri, 18 Nov 2011 12:08:20 -0500

So if I want to do this without message queues, I essentially I need a mutex around any calls into lwip from both the network task and the background worker task?

 


From: address@hidden [mailto:address@hidden On Behalf Of Simon Goldschmidt
Sent: Friday, November 18, 2011 11:22 AM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] LwIP 1.3.1 - Using tcp_write() outside of 'rawapi' callback context?

 

"Brian McFarland" <address@hidden> wrote: 

Is it safe to use tcp_write(), tcp_output(), etc from task #2 in this scenario?

No.

Do I need to put the tcp_write() call in a critical section that blocks the network task from running?

Thats one possibility, but blocking the network task is not enough: you also would have to ensure that you haven't interrupted it while it's inside the lwIP code somewhere.

Or would it be safer/better to have queues going both ways to where the network task main loop checks for pending calls to tcp_write()?

And that's the 2nd possibility, which is implemented by our API layer, BTW (e.g. by calling tcpip_callback).

 

Both possibilities work fine, it's up to you which one you like best.

 

Simon


reply via email to

[Prev in Thread] Current Thread [Next in Thread]