lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Sending with thread safety


From: Mike He
Subject: Re: [lwip-users] Sending with thread safety
Date: Mon, 06 Jul 2015 13:11:05 -0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

I am running with NO_SYS=1.

Ok, thanks for your help. I misunderstood and thought that I could only call lwIP functions from inside the ethernet interrupt handler context, since that is where the lwip timers are serviced.

If I can call from the main loop, then that is easy.

Thanks for your help.

Mike

On 7/6/2015 12:55 PM, Sergio R. Caprile wrote:
If you are running with NO_SYS=1, you don't have an OS and all you have
is a main loop or equivalent. From within than main loop you will always
call lwIP, no calls from interrupts. This is easy, right ? If you have
an asynchronous event, well, you will signal with a flag and take care
of it in the main loop; this is no different than what is normal for rx.
Sort of:

Asynchronous Tx necessity -> set txflag
controller -> there is Rx -> set rxflag
main loop ->
        sys_check_timeouts();
        rxflag -> netif_input -> tcp_input() -> your application (either
tcp_receive() or tcp_sent())
        txflag -> tcp_sndbuf() -> tcp_write() -> netif_output
                        -> no room -> tcp_poll() will take care later

This is so either for server or client frameworks, and you can see it in
the examples, or read it in the wiki:
http://lwip.wikia.com/wiki/Raw/native_API

If you are running with NO_SYS=0, you have an OS that handles threading.
You will always call lwIP functions from within the same thread, or you
will use netconn or socket, and/or you will ask someone else, not me.

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users




reply via email to

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