lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] how lwip know internet cable is unplug


From: Simon Goldschmidt
Subject: Re: [lwip-users] how lwip know internet cable is unplug
Date: Fri, 02 Sep 2011 14:32:19 +0200

address@hidden wrote:
> I'm not quite sure what you're suggesting. Is it to put all calls that may
> change states of netif, dhcp etc. in a single thread or is it the use of a
> separate thread to handle RX, or something else?

I'm just repeating the mantra that lwIP core code is not thread protected (with 
very little exceptions, mostly regarding memory management functions) and 
either all code using lwIP functions/variables must be used from one thread 
only or you have to protect it yourself (e.g. by using a semaphore or something 
like that).

E.g. if you have RX in one thread and TX in another thread, you can be most 
sure that you will get problems at some point (e.g. corrupted state, corrupted 
pbuf-ref or corrupted lists).

I have to point this out to prevent other users reading this list from making 
such a mistake (that can be hard to debug). And your statement 
"set_link_up/down looks pretty safe to use from my rx-thread" can sound like 
these functions are thread-safe to new users (as it did, to me).

Simon
-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de



reply via email to

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