Preserve the order of IPC messages between two parties.
Currently a sequence of messages between a sender A and a receiver B of the form: A.asynsend(M1, B); A.send(M2, B) may result in the receiver receiving M1 first and then M2 or viceversa. This patch makes sure that the original order M1, M2 is always preserved. Note that the order of a hypotetical sequence A.asynsend(M1, B); A.asynsend(M2, B) is already guaranteed by the implementation of asynsend by design. Other senda-based wrappers can define their own semantics.
This commit is contained in:
parent
8e5a82fd49
commit
9192dbecc9
1 changed files with 14 additions and 13 deletions
|
@ -684,6 +684,20 @@ int flags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if there are pending senda(). */
|
||||||
|
if (caller_ptr->p_misc_flags & MF_ASYNMSG)
|
||||||
|
{
|
||||||
|
if (src_e != ANY)
|
||||||
|
r= try_one(proc_addr(src_p), caller_ptr, NULL);
|
||||||
|
else
|
||||||
|
r= try_async(caller_ptr);
|
||||||
|
|
||||||
|
if (r == OK) {
|
||||||
|
IPC_STATUS_ADD(caller_ptr, IPC_STATUS_CALL_TO(SENDA));
|
||||||
|
return OK; /* Got a message */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Check caller queue. Use pointer pointers to keep code simple. */
|
/* Check caller queue. Use pointer pointers to keep code simple. */
|
||||||
xpp = &caller_ptr->p_caller_q;
|
xpp = &caller_ptr->p_caller_q;
|
||||||
while (*xpp != NIL_PROC) {
|
while (*xpp != NIL_PROC) {
|
||||||
|
@ -706,19 +720,6 @@ int flags;
|
||||||
}
|
}
|
||||||
xpp = &(*xpp)->p_q_link; /* proceed to next */
|
xpp = &(*xpp)->p_q_link; /* proceed to next */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (caller_ptr->p_misc_flags & MF_ASYNMSG)
|
|
||||||
{
|
|
||||||
if (src_e != ANY)
|
|
||||||
r= try_one(proc_addr(src_p), caller_ptr, NULL);
|
|
||||||
else
|
|
||||||
r= try_async(caller_ptr);
|
|
||||||
|
|
||||||
if (r == OK) {
|
|
||||||
IPC_STATUS_ADD(caller_ptr, IPC_STATUS_CALL_TO(SENDA));
|
|
||||||
return OK; /* Got a message */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No suitable message is available or the caller couldn't send in SENDREC.
|
/* No suitable message is available or the caller couldn't send in SENDREC.
|
||||||
|
|
Loading…
Reference in a new issue