Index: CHANGELOG
===================================================================
RCS file: /sources/lwip/lwip/CHANGELOG,v
retrieving revision 1.282
diff -u -r1.282 CHANGELOG
--- CHANGELOG	9 Jan 2008 10:05:23 -0000	1.282
+++ CHANGELOG	9 Jan 2008 22:59:50 -0000
@@ -19,6 +19,11 @@
 
   ++ New features:
 
+  2008-01-09 Frédéric Bernon
+  * tcpip.h, tcpip.c, api.h, api_lib.c, api_msg.c, sockets.c: replace the field
+    netconn::mbox (sys_mbox_t) per netconn::sem (sys_sem_t) for the task #7490
+    "Add return value to sys_mbox_post".
+
   2008-01-05 Frédéric Bernon
   * sys_arch.txt, api.h, api_lib.c, api_msg.h, api_msg.c, tcpip.c, sys.h, opt.h:
     Introduce changes for task #7490 "Add return value to sys_mbox_post" with some
Index: src/api/api_lib.c
===================================================================
RCS file: /sources/lwip/lwip/src/api/api_lib.c,v
retrieving revision 1.89
diff -u -r1.89 api_lib.c
--- src/api/api_lib.c	6 Jan 2008 14:28:04 -0000	1.89
+++ src/api/api_lib.c	9 Jan 2008 22:36:14 -0000
@@ -79,10 +79,10 @@
 
     if (conn->err != ERR_OK) {
       LWIP_ASSERT("freeing conn without freeing pcb", conn->pcb.tcp == NULL);
-      LWIP_ASSERT("conn has no mbox", conn->mbox != SYS_MBOX_NULL);
+      LWIP_ASSERT("conn has no sem", conn->sem != SYS_SEM_NULL);
       LWIP_ASSERT("conn has no recvmbox", conn->recvmbox != SYS_MBOX_NULL);
       LWIP_ASSERT("conn->acceptmbox shouldn't exist", conn->acceptmbox == SYS_MBOX_NULL);
-      sys_mbox_free(conn->mbox);
+      sys_sem_free(conn->sem);
       sys_mbox_free(conn->recvmbox);
       memp_free(MEMP_NETCONN, conn);
       return NULL;
Index: src/api/api_msg.c
===================================================================
RCS file: /sources/lwip/lwip/src/api/api_msg.c,v
retrieving revision 1.93
diff -u -r1.93 api_msg.c
--- src/api/api_msg.c	6 Jan 2008 14:28:04 -0000	1.93
+++ src/api/api_msg.c	9 Jan 2008 22:46:23 -0000
@@ -282,9 +282,9 @@
     API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0);
     sys_mbox_post(conn->recvmbox, NULL);
   }
-  if (conn->mbox != SYS_MBOX_NULL && conn->state == NETCONN_CONNECT) {
+  if (conn->sem != SYS_SEM_NULL && conn->state == NETCONN_CONNECT) {
     conn->state = NETCONN_NONE;
-    sys_mbox_post(conn->mbox, NULL);
+    sys_sem_signal(conn->sem);
   }
   if (conn->acceptmbox != SYS_MBOX_NULL) {
     /* Register event with callback */
@@ -296,7 +296,7 @@
        since the pcb has already been deleted! */
     conn->state = NETCONN_NONE;
     /* wake up the waiting task */
-    sys_mbox_post(conn->mbox, NULL);
+    sys_sem_signal(conn->sem);
   }
 }
 
@@ -470,12 +470,12 @@
   conn->type = t;
   conn->pcb.tcp = NULL;
 
-  if ((conn->mbox = sys_mbox_new(1)) == SYS_MBOX_NULL) {
+  if ((conn->sem = sys_sem_new(0)) == SYS_SEM_NULL) {
     memp_free(MEMP_NETCONN, conn);
     return NULL;
   }
   if ((conn->recvmbox = sys_mbox_new(DEFAULT_RECVMBOX_SIZE)) == SYS_MBOX_NULL) {
-    sys_mbox_free(conn->mbox);
+    sys_sem_free(conn->sem);
     memp_free(MEMP_NETCONN, conn);
     return NULL;
   }
@@ -530,8 +530,8 @@
     conn->acceptmbox = SYS_MBOX_NULL;
   }
 
-  sys_mbox_free(conn->mbox);
-  conn->mbox = SYS_MBOX_NULL;
+  sys_sem_free(conn->sem);
+  conn->sem = SYS_SEM_NULL;
 
   memp_free(MEMP_NETCONN, conn);
 }
@@ -579,7 +579,7 @@
     API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0);
     API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0);
     /* wake up the application task */
-    sys_mbox_post(conn->mbox, NULL);
+    sys_sem_signal(conn->sem);
   }
   /* If closing didn't succeed, we get called again either
      from poll_tcp or from sent_tcp */
@@ -627,8 +627,8 @@
   API_EVENT(msg->conn, NETCONN_EVT_RCVPLUS, 0);
   API_EVENT(msg->conn, NETCONN_EVT_SENDPLUS, 0);
 
-  if (msg->conn->mbox != SYS_MBOX_NULL) {
-    sys_mbox_post(msg->conn->mbox, NULL);
+  if (msg->conn->sem != SYS_SEM_NULL) {
+    sys_sem_signal(msg->conn->sem);
   }
 }
 
@@ -696,7 +696,7 @@
     setup_tcp(conn);
   }
   conn->state = NETCONN_NONE;
-  sys_mbox_post(conn->mbox, NULL);
+  sys_sem_signal(conn->sem);
   return ERR_OK;
 }
 #endif /* LWIP_TCP */
@@ -712,7 +712,7 @@
 do_connect(struct api_msg_msg *msg)
 {
   if (msg->conn->pcb.tcp == NULL) {
-    sys_mbox_post(msg->conn->mbox, NULL);
+    sys_sem_signal(msg->conn->sem);
     return;
   }
 
@@ -720,13 +720,13 @@
 #if LWIP_RAW
   case NETCONN_RAW:
     msg->conn->err = raw_connect(msg->conn->pcb.raw, msg->msg.bc.ipaddr);
-    sys_mbox_post(msg->conn->mbox, NULL);
+    sys_sem_signal(msg->conn->sem);
     break;
 #endif /* LWIP_RAW */
 #if LWIP_UDP
   case NETCONN_UDP:
     msg->conn->err = udp_connect(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
-    sys_mbox_post(msg->conn->mbox, NULL);
+    sys_sem_signal(msg->conn->sem);
     break;
 #endif /* LWIP_UDP */
 #if LWIP_TCP
@@ -735,7 +735,7 @@
     setup_tcp(msg->conn);
     msg->conn->err = tcp_connect(msg->conn->pcb.tcp, msg->msg.bc.ipaddr, msg->msg.bc.port,
                                  do_connected);
-    /* sys_mbox_post() is called from do_connected (or err_tcp()),
+    /* sys_sem_signal() is called from do_connected (or err_tcp()),
      * when the connection is established! */
     break;
 #endif /* LWIP_TCP */
@@ -955,7 +955,7 @@
     if (conn->write_delayed != 0)
 #endif
     {
-      sys_mbox_post(conn->mbox, NULL);
+      sys_sem_signal(conn->sem);
     }
   }
 #if LWIP_TCPIP_CORE_LOCKING
@@ -987,7 +987,7 @@
       if (do_writemore(msg->conn) != ERR_OK) {
         LWIP_ASSERT("state!", msg->conn->state == NETCONN_WRITE);
         UNLOCK_TCPIP_CORE();
-        sys_arch_mbox_fetch(msg->conn->mbox, NULL, 0);
+        sys_arch_sem_wait(msg->conn->sem, 0);
         LOCK_TCPIP_CORE();
         LWIP_ASSERT("state!", msg->conn->state == NETCONN_NONE);
       }
Index: src/api/sockets.c
===================================================================
RCS file: /sources/lwip/lwip/src/api/sockets.c,v
retrieving revision 1.113
diff -u -r1.113 sockets.c
--- src/api/sockets.c	4 Jan 2008 22:18:27 -0000	1.113
+++ src/api/sockets.c	9 Jan 2008 22:40:24 -0000
@@ -1301,7 +1301,7 @@
   data.optlen = optlen;
   data.err = err;
   tcpip_callback(lwip_getsockopt_internal, &data);
-  sys_arch_mbox_fetch(sock->conn->mbox, NULL, 0);
+  sys_arch_sem_wait(sock->conn->sem, 0);
   /* maybe lwip_getsockopt_internal has changed err */
   err = data.err;
 
@@ -1485,7 +1485,7 @@
     break;
 #endif /* LWIP_UDP */
   } /* switch (level) */
-  sys_mbox_post(sock->conn->mbox, NULL);
+  sys_sem_signal(sock->conn->sem);
 }
 
 int
@@ -1675,7 +1675,7 @@
   data.optlen = &optlen;
   data.err = err;
   tcpip_callback(lwip_setsockopt_internal, &data);
-  sys_arch_mbox_fetch(sock->conn->mbox, NULL, 0);
+  sys_arch_sem_wait(sock->conn->sem, 0);
   /* maybe lwip_setsockopt_internal has changed err */
   err = data.err;
 
@@ -1859,7 +1859,7 @@
     break;
 #endif /* LWIP_UDP */
   }  /* switch (level) */
-  sys_mbox_post(sock->conn->mbox, NULL);
+  sys_sem_signal(sock->conn->sem);
 }
 
 int
Index: src/api/tcpip.c
===================================================================
RCS file: /sources/lwip/lwip/src/api/tcpip.c,v
retrieving revision 1.67
diff -u -r1.67 tcpip.c
--- src/api/tcpip.c	5 Jan 2008 21:10:33 -0000	1.67
+++ src/api/tcpip.c	9 Jan 2008 23:27:49 -0000
@@ -410,7 +410,7 @@
     msg.type = TCPIP_MSG_API;
     msg.msg.apimsg = apimsg;
     sys_mbox_post(mbox, &msg);
-    sys_arch_mbox_fetch(apimsg->msg.conn->mbox, NULL, 0);
+    sys_arch_sem_wait(apimsg->msg.conn->sem, 0);
     return ERR_OK;
   }
   return ERR_VAL;
Index: src/include/lwip/api.h
===================================================================
RCS file: /sources/lwip/lwip/src/include/lwip/api.h,v
retrieving revision 1.41
diff -u -r1.41 api.h
--- src/include/lwip/api.h	5 Jan 2008 21:10:33 -0000	1.41
+++ src/include/lwip/api.h	9 Jan 2008 23:01:34 -0000
@@ -118,9 +118,8 @@
   } pcb;
   /** the last error this netconn had */
   err_t err;
-  /** mbox that is used mutex-like to synchroneously execute functions
-      in the core context */
-  sys_mbox_t mbox;
+  /** sem that is used to synchroneously execute functions in the core context */
+  sys_sem_t sem;
   /** mbox where received packets are stored until they are fetched
       by the netconn application thread (can grow quite big) */
   sys_mbox_t recvmbox;
Index: src/include/lwip/tcpip.h
===================================================================
RCS file: /sources/lwip/lwip/src/include/lwip/tcpip.h,v
retrieving revision 1.21
diff -u -r1.21 tcpip.h
--- src/include/lwip/tcpip.h	24 Nov 2007 14:50:26 -0000	1.21
+++ src/include/lwip/tcpip.h	9 Jan 2008 22:48:09 -0000
@@ -59,7 +59,7 @@
 #define LOCK_TCPIP_CORE()
 #define UNLOCK_TCPIP_CORE()
 #define TCPIP_APIMSG(m)       tcpip_apimsg(m)
-#define TCPIP_APIMSG_ACK(m)   sys_mbox_post(m->conn->mbox, NULL)
+#define TCPIP_APIMSG_ACK(m)   sys_sem_signal(m->conn->sem)
 #define TCPIP_NETIFAPI(m)     tcpip_netifapi(m)
 #define TCPIP_NETIFAPI_ACK(m) sys_sem_signal(m->sem)
 #endif /* LWIP_TCPIP_CORE_LOCKING */

