>Yes, we have a number of threads (actually two threads) using the same socket 
to send data on one thread, and receive using the other thread. The socket in 
question 
has been marked with the NONBLOCK flag (using ioctlsocket(sock, FIONBIO, 
&dontBlock)). 

So, it's a kind of full duplex protocol you do? About your question, I will 
answer on the current CVS HEAD: yes there is an asumption (but no code for 
that) that one message to tcpip_thread (sent by tcpip_apimsg) is "acknowledged" 
in the same order than "send order". Why, because each netconn only have one 
"mbox" to receive acknowledge (not that a mbox here is a strange idea, and we 
have talk about to replace it by a sem). Because so, if task1 send a message 
and wait the acknowledge, if task2 wait the acknowledge, and if tcpip_thread 
"post" an acknowledge (after processing task1 message by example), one of the 
task will be wake up (both "fetch" the same mbox), but we can't grant which one 
(so, you could consider the action is done, but perhaps it's not the case). 
 
There is a item open on that, where we talk about some solution (mainly, for 
support full duplex protocols): https://savannah.nongnu.org/patch/?5960. The 
main idea is to add a semaphore per netconn, to synchronize multithread access, 
but, this solution seems to never be check in in the CVS HEAD :(  , because 
it's not a common problem (but perhaps Kieran could change his point of view ;) 
)
 
Note that in UDP, you shouldn't have any problems (the netconn_recv only fetch 
the recvmbox, without sending message to tcpip_thread).
 
 
  
====================================
Frédéric BERNON 
HYMATOM SA 
Chef de projet informatique 
Microsoft Certified Professional 
Tél. : +33 (0)4-67-87-61-10 
Fax. : +33 (0)4-67-70-85-44 
Email : [EMAIL PROTECTED] 
Web Site : http://www.hymatom.fr <http://www.hymatom.fr/>  
====================================
P Avant d'imprimer, penser à l'environnement
 

        -----Message d'origine-----
        De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de [EMAIL 
PROTECTED]
        Envoyé : vendredi 1 juin 2007 12:04
        À : Mailing list for lwIP users
        Objet : Ang. Re: [lwip-users] LwIP and semaphores.
        
        

        >Kieran Mansley <[EMAIL PROTECTED]>  wrote 2007-06-01 11:52:39 :
        >
        > On Fri, 2007-06-01 at 11:41 +0200, [EMAIL PROTECTED]
        > wrote:
        > > 
        > > Does LwIP make any asumption on the order that semaphores are
        > > released. 
        > > I.e. if two threads use LwIP does the LwIP TCP/IP-thread assume that
        > > the messages 
        > > sent over a common message box will be received by the threads in 
the
        > > order that they are sent? 
        > > Or is it ok to have a "polling" semaphore system where threads 
waiting
        > > on the same semaphore might 
        > > be woken regardless to how long they have been waiting. 
        > 
        > Can you provide some more details?  This sounds rather like you're 
using
        > the same connection from two different threads without using a mutex 
to
        > protect it.  Frederic is the expert on this, and has ideas about how 
to
        > resolve it, but it's known not to work at the moment.  It's probably
        > best to assume that lwIP, for reasons of simplicity, doesn't currently
        > support multiple threads using the same connection at the same time.
        > 
        > Kieran
        > 
        
        Yes, we have a number of threads (actually two threads) using the same 
socket 
        to send data on one thread, and receive using the other thread. The 
socket in question 
        has been marked with the NONBLOCK flag (using ioctlsocket(sock, 
FIONBIO, &dontBlock)). 
        
        At the same time were using a "polling" semaphore system... And the 
problem right now 
        is that after some heave traffic the sending thread seem to get stuck 
in a call to lwip_send(). 
        
        //Hans 
        

<<image001.jpg>>

<<image002.jpg>>

BEGIN:VCARD
VERSION:2.1
N:BERNON;Frédéric;;M.
FN:Frédéric BERNON
ORG:HYMATOM SA;Recherche et Développement
TITLE:Chef de projet informatique
TEL;WORK;VOICE:04-67-87-61-10
TEL;WORK;FAX:04-67-70-85-44
ADR;WORK;ENCODING=QUOTED-PRINTABLE:;23;Zone Industrielle=0D=0A175 rue de Massacan;VENDARGUES;;34740;FRANCE;
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:23=0D=0AZone Industrielle=0D=0A175 rue de Massacan=0D=0AVENDARGUES 34740=0D=
=0AFrance
URL;WORK:http://www.hymatom.fr
ROLE:Chef de projet informatique
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20020404T083210Z
END:VCARD
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to