lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] LWIP_TCPIP_CORE_LOCKING option


From: Simon Goldschmidt
Subject: Re: [lwip-users] LWIP_TCPIP_CORE_LOCKING option
Date: Tue, 22 Nov 2016 09:10:56 +0100

Rastislav Uhrin wrote:
> Question: Can I disable core locking, I mean:
> #define LWIP_TCPIP_CORE_LOCKING       0
>  
>It works with and without locking. I don’t see any noticeable difference, but 
>I don’t understand if the core should be locked in my case > or no. Maybe it 
>works because of my task priorities?

The core code of lwIP is not protected against concurrent access. As such, 
"API" code has
to take care of multithreading. The old method was message-passing (i.e. send 
-> message
to tcpip_thread -> tcpip_thread executes the send and wakes up the API thread 
when done).
Now when enabling CORE_LOCKING, we use a global mutex instead of message 
passing.

Both versions work but with current operating systems, the mutex version should 
be faster
since in the case when noone else is working with the core, grabbing a mutex is 
so much
faster than 2 thread context switches.


Simon



reply via email to

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