[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Raw API / Threading
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] Raw API / Threading |
Date: |
Thu, 22 Oct 2009 08:30:19 +0200 |
> I'm a bit confused in regards to using the raw API in a multi-threaded
> enviromnent. The current documentation indicates that you can not call the
> raw API functions from a context outside of the main lwIP process. Is this
> true?
Yes, this is correct and has been since for all the lwIP history (at least
what's in CVS)!
> I have old code that appears to refute that.
>
> I have a project using FreeRTOS and what appears to be lwIP v1.1. In it
> there are separate tasks that call udp_send() while the bulk of lwIP runs in
> it's own task. This code runs without problem.
You're lucky there! lwIP includes lists that are sometimes re-sorted which can
end up in system crash when used simultaneously from different threads! I
strongly suggest you'd fix your code, no matter if you upgrade to 1.3.1 or stay
with 1.1.0.
To do that, you can just use tcpip_callback() to get your code running in the
tcpip_thread context, where you can safely call udp_send().
Simon
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01