New function tcpip_callback_wait() * Call a function inside the tcpip thread and block the calling thread until the callback finishes.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Joan Lledó
2019-05-19 11:08:45 +02:00
committed by Simon Goldschmidt
parent 3546a0a4a0
commit 9dca4a0211
3 changed files with 56 additions and 1 deletions

View File

@@ -123,7 +123,8 @@ enum tcpip_msg_type {
TCPIP_MSG_UNTIMEOUT,
#endif /* LWIP_TCPIP_TIMEOUT && LWIP_TIMERS */
TCPIP_MSG_CALLBACK,
TCPIP_MSG_CALLBACK_STATIC
TCPIP_MSG_CALLBACK_STATIC,
TCPIP_MSG_CALLBACK_STATIC_WAIT
};
struct tcpip_msg {
@@ -139,6 +140,11 @@ struct tcpip_msg {
struct tcpip_api_call_data *arg;
sys_sem_t *sem;
} api_call;
struct {
tcpip_callback_fn function;
void *ctx;
sys_sem_t *sem;
} cb_wait;
#endif /* LWIP_TCPIP_CORE_LOCKING */
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
struct {

View File

@@ -81,6 +81,7 @@ err_t tcpip_input(struct pbuf *p, struct netif *inp);
err_t tcpip_try_callback(tcpip_callback_fn function, void *ctx);
err_t tcpip_callback(tcpip_callback_fn function, void *ctx);
err_t tcpip_callback_wait(tcpip_callback_fn function, void *ctx);
/** @ingroup lwip_os
* @deprecated use tcpip_try_callback() or tcpip_callback() instead
*/