[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Sending with thread safety
From: |
Sergio R. Caprile |
Subject: |
Re: [lwip-users] Sending with thread safety |
Date: |
Mon, 06 Jul 2015 16:55:47 -0300 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
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.