> > > tcp_in.c in lwIP 1.2.0 makes use of static global > variables to pass > > > arguments between functions. This implies that tcp_input is not > > re-entrant. > > > However this doesn't seem to be documented in ethernetif.c or > > > anywhere > > else. > > > Is there something I'm missing here? > > > > Does it have to be documented in ethernetif.c? Why would you call > > tcp_input more than once? That would mean you would call > tcp_input (or > > maybe > > netif->input) > > from your netif->output function (which may be called in tcp_input). > > That is > > not allowed in RAW mode (API mode puts that packet on a > queue only, so > > the function is not really called again). This is documented, for > > example in loopif.c. Maybe it should be documented better... > > That said, is there any compelling reason to use static > global variables rather than function arguments? >
Hehe, I remember complaining about that over a year ago. At that time, I think the response was 'leave it as it is'... Removing any global variables is also a necessary step when giving the stack more multithreading capabilities (e.g. configuring high- and low-prio connections to run in different threads...). I think it would be a good thing moving from global variables to parameters, but I remember adam writing about intentionally using global variables as a design goal in embedded systems (using a smaller stack, favouring statically configured memory) which is an opinion I don't share, but we would have to discuss that! Simon _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
