Hello,
I do not understand, or there is a problem, with the semantic of void
sys_mbox_post(sys_mbox_t mbox, void *msg).
sys_mbox_post(...) is called by, among several places,
err_t
tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
{
struct tcpip_msg *msg;
if (mbox != SYS_MBOX_NULL) {
msg = memp_malloc(MEMP_TCPIP_MSG_API);
if (msg == NULL) {
return ERR_MEM;
}
msg->type = TCPIP_MSG_TIMEOUT;
msg->msg.tmo.msecs = msecs;
msg->msg.tmo.h = h;
msg->msg.tmo.arg = arg;
sys_mbox_post(mbox, msg);
return ERR_OK;
}
return ERR_VAL;
}
and
err_t
tcpip_apimsg(struct api_msg *apimsg)
{
struct tcpip_msg msg;
if (mbox != SYS_MBOX_NULL) {
msg.type = TCPIP_MSG_API;
msg.msg.apimsg = apimsg;
sys_mbox_post(mbox, &msg);
sys_arch_sem_wait(apimsg->msg.conn->op_completed, 0);
return ERR_OK;
}
return ERR_VAL;
}
Please note that the latter is passing a TCPIP_msg instance on the stack, which
need therefore to be copied before being queued.
The first instead is allocating the message, which therefore does not need to
be copied.
Which semantic is the right one and exactly what are the requirements on the
implementor of sys_mbox_post(...)?
Regards
L.
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users