mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-24 17:17:03 +08:00
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:
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user