lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] RE: lwip-users Digest, Vol 8, Issue 13


From: Leon Woestenberg
Subject: Re: [lwip-users] RE: lwip-users Digest, Vol 8, Issue 13
Date: Sun, 02 May 2004 00:13:14 +0200

Hello Eric,

On Fri, 30 Apr 2004 19:57:46 -0400, "Eric Shufro" <address@hidden> said:
> OK, I am a bit confused.
> 
> I barley understand what it means to be / not be multithreaded safe, but
> the gist of it is clear.
> 
If you are developing a multithreadd application, you must know the ins
and
outs of being multithread safe. What helps me in designing multithreaded
systems is to assume that a thread can be pre-empted by any other thread
or
interrupt at *any* processor instruction, or even *within* a single
processor
instructions.

If you then design the system to be correct with the above being given,
you
have at least designed something thread-safe (but not necessarily correct
:-)

The lwIP core is NOT thread-safe.

There are some minor provisions in the optional system layer (sysarch)
and
pbuf code to serialize access to critical sections, but this will not
work
for most operating systems.

Two relatively easy solutions to use lwIP in multi-threaded systems:
1) Call lwIP from one thread only (note: and have any network interrupt
wake
up this thread; do not interleave the single thread with any interrupt
code calling lwIP (drivers)).

2) Use a big mutual exclusion lock for lwIP that features priority
inheritance.

Making lwIP thread-safe by itself would be hard as it needs to rely on
the
underlying OS or hardware and that would need some kind of adaptation
layer.

In that sense, an interesting project would be to make lwIP thread-safe
on
the eCos real-time OS, as it has a HAL in place.

Regards,

Leon.




reply via email to

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