Commit 327f59bb authored by Pekka Pessi's avatar Pekka Pessi

su_root.c: su_msg_delivery_report() destroys msg sans reporting function.

su_port.c: su_port_getmsgs() streamlined

darcs-hash:20060823131627-65a35-f0b0270f0f282eb3bb81118508e1729418373070.gz
parent 9ad4e865
......@@ -603,16 +603,11 @@ int su_port_getmsgs(su_port_t *self)
f = msg->sum_func;
if (f)
f(SU_ROOT_MAGIC(msg->sum_to->sut_root), &msg, msg->sum_data);
if (msg && msg->sum_report)
su_msg_delivery_report(&msg);
else
su_msg_destroy(&msg);
su_msg_delivery_report(&msg);
n++;
}
/* Check for wait events that may have been generated by this message */
/* Check for wait events that may have been generated by messages */
su_port_wait_events(self, 0);
}
......
......@@ -1402,8 +1402,12 @@ int su_msg_create(su_msg_r rmsg,
return -1;
}
/** Add a report function to a message
*
/** Add a delivery report function to a message.
*
* The delivery report funcgtion gets called by the sending task after the
* message was delivered and the message function was executed. (The
* su_root_t message delivery loop calls su_msg_delivery_report()
*
*/
int su_msg_report(su_msg_r msg,
su_msg_f report)
......@@ -1442,23 +1446,35 @@ int su_msg_reply(su_msg_r reply, su_msg_r const msg,
}
/** Send a delivery report
/** Send a delivery report.
*
* If the sender has attached a delivery report function to message with
* su_msg_report(), the message is returned to the message queue of the
* sending task. The sending task calls the delivery report function when it
* has received the message.
*/
void su_msg_delivery_report(su_msg_r msg)
{
su_task_r swap;
if (!msg || !msg[0])
return;
if (!msg[0]->sum_report) {
su_msg_destroy(msg);
return;
}
*swap = *msg[0]->sum_from;
*msg[0]->sum_from = *msg[0]->sum_to;
*msg[0]->sum_to = *swap;
msg[0]->sum_func = msg[0]->sum_report;
msg[0]->sum_report = NULL;
su_msg_send(msg);
}
/** Save a message */
/** Save a message. */
void su_msg_save(su_msg_r save, su_msg_r msg)
{
if (save) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment