mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-18 20:10:53 +00:00
tcpip.h, tcpip.c: add tcpip_callback_with_block function for the task #7490 "Add return value to sys_mbox_post". tcpip_callback is always defined as "blocking" ("block" parameter = 1).
This commit is contained in:
parent
bceff76c70
commit
4e40fee1db
@ -19,6 +19,11 @@ HISTORY
|
|||||||
|
|
||||||
++ New features:
|
++ New features:
|
||||||
|
|
||||||
|
2008-01-10 Frédéric Bernon
|
||||||
|
* tcpip.h, tcpip.c: add tcpip_callback_with_block function for the task #7490
|
||||||
|
"Add return value to sys_mbox_post". tcpip_callback is always defined as
|
||||||
|
"blocking" ("block" parameter = 1).
|
||||||
|
|
||||||
2008-01-10 Frédéric Bernon
|
2008-01-10 Frédéric Bernon
|
||||||
* tcpip.h, tcpip.c, api.h, api_lib.c, api_msg.c, sockets.c: replace the field
|
* 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
|
netconn::mbox (sys_mbox_t) per netconn::sem (sys_sem_t) for the task #7490
|
||||||
|
@ -349,10 +349,11 @@ tcpip_input(struct pbuf *p, struct netif *inp)
|
|||||||
*
|
*
|
||||||
* @param f the function to call
|
* @param f the function to call
|
||||||
* @param ctx parameter passed to f
|
* @param ctx parameter passed to f
|
||||||
|
* @param block 1 to block until the request is posted, 0 to non-blocking mode
|
||||||
* @return ERR_OK if the function was called, another err_t if not
|
* @return ERR_OK if the function was called, another err_t if not
|
||||||
*/
|
*/
|
||||||
err_t
|
err_t
|
||||||
tcpip_callback(void (*f)(void *ctx), void *ctx)
|
tcpip_callback_with_block(void (*f)(void *ctx), void *ctx, u8_t block)
|
||||||
{
|
{
|
||||||
struct tcpip_msg *msg;
|
struct tcpip_msg *msg;
|
||||||
|
|
||||||
@ -365,7 +366,14 @@ tcpip_callback(void (*f)(void *ctx), void *ctx)
|
|||||||
msg->type = TCPIP_MSG_CALLBACK;
|
msg->type = TCPIP_MSG_CALLBACK;
|
||||||
msg->msg.cb.f = f;
|
msg->msg.cb.f = f;
|
||||||
msg->msg.cb.ctx = ctx;
|
msg->msg.cb.ctx = ctx;
|
||||||
sys_mbox_post(mbox, msg);
|
if (block) {
|
||||||
|
sys_mbox_post(mbox, msg);
|
||||||
|
} else {
|
||||||
|
if (sys_mbox_trypost(mbox, msg) != ERR_OK) {
|
||||||
|
memp_free(MEMP_TCPIP_MSG_API, msg);
|
||||||
|
return ERR_MEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
return ERR_VAL;
|
return ERR_VAL;
|
||||||
|
@ -82,7 +82,9 @@ err_t tcpip_netifapi_lock(struct netifapi_msg *netifapimsg);
|
|||||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||||
#endif /* LWIP_NETIF_API */
|
#endif /* LWIP_NETIF_API */
|
||||||
|
|
||||||
err_t tcpip_callback(void (*f)(void *ctx), void *ctx);
|
err_t tcpip_callback_with_block(void (*f)(void *ctx), void *ctx, u8_t block);
|
||||||
|
#define tcpip_callback(f,ctx) tcpip_callback_with_block(f,ctx,1)
|
||||||
|
|
||||||
err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
|
err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
|
||||||
#define tcpip_untimeout(h, arg) tcpip_timeout(0xffffffff, h, arg)
|
#define tcpip_untimeout(h, arg) tcpip_timeout(0xffffffff, h, arg)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user