Add LWIP_TCPIP_CORE_LOCKING option (0 as default value) to experiment "locking" as feature to communicate with tcpip_thread for sequential API (netconn & socket layers). Add a alternative code for lwip_sendto to how the code can be optimized with such feature....

This commit is contained in:
fbernon
2007-06-08 19:27:59 +00:00
parent 0b9c9f9ede
commit 090aaefb39
8 changed files with 95 additions and 25 deletions

View File

@@ -474,6 +474,11 @@ a lot of data that needs to be copied, this should be set high. */
#define DEFAULT_THREAD_PRIO 1
#endif
/* ---------- Sequential layer options */
/* EXPERIMENTAL, Don't use it if you're not an active lwIP project member */
#ifndef LWIP_TCPIP_CORE_LOCKING
#define LWIP_TCPIP_CORE_LOCKING 0
#endif
/* ---------- Socket options ---------- */
/* Enable BSD-style sockets functions names */

View File

@@ -40,8 +40,25 @@
extern "C" {
#endif
#if LWIP_TCPIP_CORE_LOCKING
/** The global semaphore to lock the stack. */
extern sys_sem_t lock_tcpip_core;
#define LOCK_TCPIP_CORE() sys_sem_wait(lock_tcpip_core)
#define UNLOCK_TCPIP_CORE() sys_sem_signal(lock_tcpip_core)
#define TCPIP_APIMSG(m) tcpip_apimsg_lock(m)
#define TCPIP_APIMSG_ACK(m)
#else
#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)
#endif /* LWIP_TCPIP_CORE_LOCKING */
void tcpip_init(void (* tcpip_init_done)(void *), void *arg);
err_t tcpip_apimsg(struct api_msg *apimsg);
#if LWIP_TCPIP_CORE_LOCKING
err_t tcpip_apimsg_lock(struct api_msg *apimsg);
#endif /* LWIP_TCPIP_CORE_LOCKING */
#if ETHARP_TCPIP_INPUT
err_t tcpip_input(struct pbuf *p, struct netif *inp);
#endif /* ETHARP_TCPIP_INPUT */