lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] mutex API in system layer is necessary ?


From: vincent cui
Subject: Re: [lwip-users] mutex API in system layer is necessary ?
Date: Tue, 8 May 2012 05:54:25 +0000

Hi simon:

I use the following code to receive file from client tool, the receive speed 
will be up to down after send 3 times .
Is it LWIP bug ?

static err_t server_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t 
err)
{
 
        if (err == ERR_OK && p != NULL) 
        {  
                struct pbuf *q;   
                u16_t tot_len = 0;   

                for (q = p; q != NULL; q = q->next) 
                {   
                        tot_len += q->len;    
                }   
        
                tcp_recved(pcb, tot_len);  
                pbuf_free(p); 
        }  

      if (err == ERR_OK && p == NULL) {
            close_conn(pcb);
      }
      return ERR_OK;
}

Vincent Cui
Firmware Engineer Leader
Mobile: +8613482482211
Tel: +86 21 34612525x6104
Fax: +86 21 34619770
E-Mail: address@hidden
Shanghai EnLogic Electric Technology Co., Ltd.
Address: 1104-1106, Building A, No.391, Guiping Road, Xuhui District, Shanghai, 
200233
 

-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Simon Goldschmidt
Sent: 2012年5月8日 13:21
To: Mailing list for lwIP users
Subject: Re: [lwip-users] mutex API in system layer is necessary ?

vincent cui <address@hidden> wrote:
> I had port latest lwip1.4.0 to my system, it works well . but I found some
> additional api about mutex are defined in 1.4.0
> 
> I want to know that are they necessary ?

No, as it says in sys.h: "Define LWIP_COMPAT_MUTEX if the port has no mutexes 
and binary semaphores should be used instead". The only disadvantage of using 
binary semaphores (in this case, the sys_mutex_* functions are defined to their 
sys_sem_* substitute) is that you can get priority inversion (mutextes are only 
used for communication between API tasks using netconn or sockets and the 
tcpip_thread).

Simon
-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                          
        
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a

_______________________________________________
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]