lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Threading Question using LWIP with TM4C1294NCPDT


From: Terence Darwen
Subject: [lwip-users] Threading Question using LWIP with TM4C1294NCPDT
Date: Thu, 18 Oct 2018 15:27:02 -0500

I'm using LWIP for TCP/IP communication on a TI Tiva microcontroller (a TM4C1294NCPDT).  TI includes LWIP 1.4.1 in its TivaWare package.  I've read that LWIP is not threadsafe, however, I'm not sure exactly what that means in my context where I'm using it with no operating system on the single core TI Tiva microcontroller.

It seems the way LWIP works on the Tiva is during the SysTick interrupt, you call the lwIPTimer function giving it an amount of time for processing.  lwIPTimer then triggers the Tiva's ethernet interrupt and it does it's processing for the given amount of time.

Inside the lwIPTimer function, I see this comment above the line of code that triggers the Tiva's ethernet interrupt:

    //
    // Generate an Ethernet interrupt.  This will perform the actual work
    // of checking the lwIP timers and taking the appropriate actions.  This is
    // needed since lwIP is not re-entrant, and this allows all lwIP calls to
    // be placed inside the Ethernet interrupt handler ensuring that all calls
    // into lwIP are coming from the same context, preventing any reentrancy
    // issues.  Putting all the lwIP calls in the Ethernet interrupt handler
    // avoids the use of mutexes to avoid re-entering lwIP.
    //

My current code is making calls to tcp_write() and tcp_output() *outside* of the ethernet interrupt handler.  My calls to tcp_write() and tcp_output() occur in the SysTick interrupt just before I call lwIPTimer().  Does this violate the advice in the comment above?  I'm unsure since these are "tcp_" calls and not "lwIP" calls.

Can anyone please clarify?  Thank you.

reply via email to

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