[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] Reentrancy in LWIP
From: |
Kieran Mansley |
Subject: |
RE: [lwip-users] Reentrancy in LWIP |
Date: |
Tue, 28 Sep 2010 14:48:17 +0100 |
On Tue, 2010-09-28 at 19:04 +0530, Chandran, Smitha wrote:
> I have been going through the lwip source code and I have seen instances of
> methods which update data into variables and return them...
> My intention is to interface lwip to both an ethernet device as well as a
> usb-wifi device...
> So was wondering if such non-rentrant code could lead to issues.
Yes, it would, but you shouldn't write your code that way: lwIP core
should only be accessed by a single thread. The normal method to
achieve this is to have all lwIP processing done by a single thread and
the device drivers (e.g. for Ethernet or USB) pass packets to this
thread for processing. This isn't an just an issue where you have more
than one device driver either, it applies to protecting lwIP from
concurrent access by application threads and device driver context too.
Kieran