LWIP_NETCONN_FULLDUPLEX: unblock rx threads on close

Threads blocked on the rx mbox are counted and on close,
one "netconn closed" message per thread is posted to the mbox
to ensure all threads are woken.

The netconn can then be safely deleted. In socket API, "fd_used"
and "fd_free_pending" help with auto-deleting the netconn.

Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
goldsimon
2018-04-18 21:51:34 +02:00
parent 41fea4ad7d
commit 3abc8ae161
4 changed files with 98 additions and 23 deletions

View File

@@ -241,6 +241,11 @@ struct netconn {
by the application thread */
sys_mbox_t acceptmbox;
#endif /* LWIP_TCP */
#if LWIP_NETCONN_FULLDUPLEX
/** number of threads waiting on an mbox. This is required to unblock
all threads when closing while threads are waiting. */
int mbox_threads_waiting;
#endif
/** only used for socket layer */
#if LWIP_SOCKET
int socket;

View File

@@ -187,6 +187,9 @@ struct dns_api_msg {
};
#endif /* LWIP_DNS */
#if LWIP_NETCONN_FULLDUPLEX
int lwip_netconn_is_deallocated_msg(void *msg);
#endif
int lwip_netconn_is_err_msg(void *msg, err_t *err);
void lwip_netconn_do_newconn (void *m);
void lwip_netconn_do_delconn (void *m);