lwip-users
[Top][All Lists]
Advanced

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

RE : Ang. Re: [lwip-users] LwIP and semaphores.


From: Frédéric BERNON
Subject: RE : Ang. Re: [lwip-users] LwIP and semaphores.
Date: Fri, 1 Jun 2007 12:36:13 +0200

>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 : address@hiddenr
Web Site : http://www.hymatom.fr
====================================
P Avant d'imprimer, penser à l'environnement
 
-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de address@hidden
Envoyé : vendredi 1 juin 2007 12:04
À : Mailing list for lwIP users
Objet : Ang. Re: [lwip-users] LwIP and semaphores.


>Kieran Mansley <address@hidden>  wrote 2007-06-01 11:52:39 :
>
> On Fri, 2007-06-01 at 11:41 +0200, address@hidden
> 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

Attachment: Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf


reply via email to

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