lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] How to use LWIP from FreeRTOS tasks - a thread safety quest


From: Peter
Subject: [lwip-users] How to use LWIP from FreeRTOS tasks - a thread safety question
Date: Sat, 06 Aug 2022 16:00:07 +0100

This has been solved. The various online examples which show mutexing
of the low level input and output are using the same mutex which LWIP
itself uses for protecting its API if LWIP_TCPIP_CORE_LOCKING=1.

Obviously that will just hang! You have to use a different mutex for
the low level I/O.

But actually it seems clear that NO mutex is needed at the low level
end anyway, because LWIP itself only ever makes a single threaded call
to low_level_output. And low_level_input is just an RTOS task which
runs in a loop by itself so that needs no protection.

All this has been running for weeks now, multiple threads doing ETH
activity, different outside servers, HTTP and TLS concurrently, 24/7.

Last question is this:

It has been claimed that:

1) The LWIP netconn and socket API is thread safe regardless of
LWIP_TCPIP_CORE_LOCKING. The only benefit of LWIP_TCPIP_CORE_LOCKING=1
is that it also makes the RAW API thread safe also.

2) LWIP_TCPIP_CORE_LOCKING=1 is more efficient internally in LWIP if
it is called from multiple RTOS tasks.

I hae not been able to verify 1) or 2) and asking the claimants
yielded silence. Lots of conflicting info online.



reply via email to

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