|
From: | Scott Taggart |
Subject: | Re: [lwip-users] critical section protection + timer issues |
Date: | Fri, 18 Feb 2005 17:20:24 -0800 |
OK, Based on what both Jim and Adam says there is still something I obviously have no clue on. Perhaps it’s because I am not calling into the LWIP stack properly that is leading to my confusion. I will start by asking a “stupid” question – perhaps the answer will tell me why I am so confused on this thread-timer-blocking issue…
My question is: suppose I have an arbitrary thread that wants to establish a TCP connection and transfer data. Should this thread call tcp_connect, tcp_write, etc.? Or should it call a different level interface (perhaps use the mailbox that tcpip_thread processes)? I ask this because if the answer is: it should call tcp_connect, et. al., then I see no possible way for this thread to not also call one of the three sys.c “blocking” functions in order for the LWIP timer logic to work. Here’s my reasoning:
Thread 1 calls tcp_connect which results in a timer entry being created for THAT THREAD ONLY.
Now, until that same thread blocks on one of the three LWIP sys.c calls (sys_mbox_fetch(), etc.) then that timer for that tcp_connect will never fire.
I have seen various contradictions to this in the responses. Adam’s response also implies this is not true. The only way I can see this not true is that threads never call the raw interface but instead always go through the mailbox interface that tcpip_thread processes. If this is so, then I “get it”. Did I just misunderstand what interface that a threaded system should use (i.e., a threaded system should use tcpip_thread and its mailbox unless the threads always can block in the sys_mbox_fetch, et. al. calls)?
My apologies for any offense. I am frustrated with this (my fault) and thought I understood it only to find out quite a bit of work will not work because of that misunderstanding.
Scott
[Prev in Thread] | Current Thread | [Next in Thread] |