lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] multi-threaded environment


From: Leon Woestenberg
Subject: Re: [lwip-users] multi-threaded environment
Date: Fri, 26 Mar 2004 01:46:48 +0100
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)

Hello Tom,

Tom C. Barker wrote:
Thanks Peter.

I have resolved the issue of timeouts and my stack
runs as long as I make my main loop TCPIP_THREAD_PRIO + 1
and I don't use DHCP timers...go figure

Instead of focussing finding out when it works, you should
find out when it breaks.

Only then can we think of fixing the problem.

I use descending priorities so TCPIP_THREAD_PRIO + 1 is one higher priority than the tcp timers.

Whenever I make the main loop TCPIP_THREAD_PRIO, add
a thread for DHCP timers or add DHCP timers while I'm in
the tcpip_init thread, I get one of the following ASSERTs.

   Assertion "memp sanity" failed...memp.cpp (memp.c)
   Assertion "pbuf_free: p->ref > 0" failed at line 576 in pbuf.cpp (pbuf.c)

Are you sure your calls into lwIP are serialized?

lwIP must be regarded as non thread safe; you must
1) serialize calling the functions
2) make sure a thread which is in an lwIP call, is not pre-empted
   by another thread which then performs an lwIP call as well.

Usually, you can do so with a (priority-inheriting) mutual exclusion semaphore.

Good luck,

Leon.




-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf
Of Peter Graf
Sent: Monday, March 22, 2004 2:23 AM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] multi-threaded environment


Tom C. Barker wrote:


[Snip]
Additionally, has anyone written a guide to initializing
tasks. I've found samples but it seems that no real explanations are lying around.



No, but for me reading the according portions of sys_arch.c from the Unix port was not too hard, and gave me a good idea of what had to be done.

As you mention task initialization (which is quite unproblematic) I'd like to point to the more complicated (clean) removal of tasks from lwIP usage. This issue hasn't been given much (any?) attention, probably because embedded multitasking systems tend to create tasks only once and then never remove them. Are there any plans to standardize task removal, or is it not of general interest? (I have always been postponing to implement it, but someday I'll surely need it.)

Peter



_______________________________________________
lwip-users mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/lwip-users





reply via email to

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