lwip-members
[Top][All Lists]
Advanced

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

Re: [lwip-members] static variables in ip.c


From: leon . woestenberg
Subject: Re: [lwip-members] static variables in ip.c
Date: Fri, 22 Nov 2002 14:50:56 +0100 (MET)

Hello,

> A while back Leon spotted that struct netif * variable in ip_output was
> static
> and Adam confirmed it's a bug.But there are more such defs in ip.c.
> And that one was not yet fixed.
> It's a good idea to make them all local vars don't you think?
> 
This may sound strange, but it may not be a bug after all!

The ip module may not be called concurrently from two tasks, because most of
the code (roughly 60%) acts on private ip data structures (such as the
routing table).

So, given that fact, the ip module does not need to be re-entrant, and so
the usage of static to reduce stack size usage is actually a valid approach.

In a real neat approach, ip should be re-entrant and multi-threading safe,
but that needs entangling a lot of synchronization constructs (probably
semaphore/mutex locks).

If we do want to make the stack multi-threading safe, there is lot more work
to do besides ip. I suggest we defer this to later, there are more important
archtectural issues to tackle first.

Leon.

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!





reply via email to

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