[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] netconn_write/recv from two different tasks..
From: |
Sylvain Rochet |
Subject: |
Re: [lwip-users] netconn_write/recv from two different tasks.. |
Date: |
Wed, 6 Mar 2013 15:54:33 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi Thomas,
On Wed, Mar 06, 2013 at 06:43:15AM -0800, ThomasJ wrote:
> Hi
>
> Just an idea... and would it work?
>
> If I keep my TX task and RX task.
> I then make make sure the TXTask does not use the netconn_write while the
> RXTask is in the netconn_recv call.
> Would that be ok or must the net connection be handle only by the same task?
I already told you about that. This is exactly the same thing from the
lwIP point of view or generally speaking for any multithreading
environment, this is not strictly lwIP-specific. The point is that
netconn_ functions are not reentrant for -a- UDP or TCP control block,
so serializing them through a mutex/semaphore from sparse threads will
work.
But beware of dead locks conditions!, you are going to run a
mutex/semaphore over a message passing system which of course cause
contexts switchs (so priority reordering), this requires strict checking
of any possible locking cases between 3 threads, a mutex/semaphore, and
a mbox.
Sylvain