anchao commented on pull request #4080:
URL: https://github.com/apache/incubator-nuttx/pull/4080#issuecomment-879787044


   > i'm not sure what you mean here. can you explain a bit?
   
   If we move the check outside the wrbuffer, we will duplicate a lot of 
sem_post codes in these places. Do you want to do this? I don't think there is 
any place like net/tcp/tcp_wrbuffer.c is more suitable.
   
   ```
   net/tcp/tcp_send_buffered.c:214:          tcp_wrbuffer_release((FAR struct 
tcp_wrbuffer_s *)entry);
   net/tcp/tcp_send_buffered.c:220:          tcp_wrbuffer_release((FAR struct 
tcp_wrbuffer_s *)entry);
   net/tcp/tcp_send_buffered.c:434:                  tcp_wrbuffer_release(wrb);
   net/tcp/tcp_send_buffered.c:607:              tcp_wrbuffer_release(wrb);
   net/tcp/tcp_send_buffered.c:672:              tcp_wrbuffer_release(wrb);
   net/tcp/tcp_send_buffered.c:1246:  tcp_wrbuffer_release(wrb);
   net/tcp/tcp_conn.c:741:      tcp_wrbuffer_release(wrbuffer);
   net/tcp/tcp_conn.c:747:      tcp_wrbuffer_release(wrbuffer);
   net/tcp/tcp_wrbuffer.c:157:      tcp_wrbuffer_release(wrb);
   net/tcp/tcp_wrbuffer.c:213:      tcp_wrbuffer_release(wrb);
   ```
   like this ? 
   
   net/tcp/tcp_wrbuffer.c:
   
   ```
   tcp_wrbuffer_release(wrb);
   #if CONFIG_NET_SEND_BUFSIZE > 0
     if (conn)
       {
         int val = 0;
   
         nxsem_get_value(&conn->snd_sem, &val);
         if (val < 0)
           {
             nxsem_post(&conn->snd_sem);
           }
       }
   #endif
   ```
   
   net/tcp/tcp_conn.c:
   ```
   tcp_wrbuffer_release(wrb);
   #if CONFIG_NET_SEND_BUFSIZE > 0
     if (conn)
       {
         int val = 0;
   
         nxsem_get_value(&conn->snd_sem, &val);
         if (val < 0)
           {
             nxsem_post(&conn->snd_sem);
           }
       }
   #endif
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to