diff --git a/minix/kernel/mqueue.c b/minix/kernel/mqueue.c index 0093db282..dfd2e0616 100644 --- a/minix/kernel/mqueue.c +++ b/minix/kernel/mqueue.c @@ -176,7 +176,10 @@ int message_index_with_highprio(int mqdes, endpoint_t dst) prio = mq.msg[mqdes].msge[i].priority; for (int j = 0; j < MAX_RECEIVERS; j++) { if (mq.msg[mqdes].msge[i].dst[j] == dst) { - if (max_prio < find_max(max_prio, prio)) { + if (max_prio == prio) { + if (mq.msg[mqdes].msge[i].timestamp > mq.msg[mqdes].msge[index].timestamp) + index = i; + } else if (max_prio < find_max(max_prio, prio)) { index = i; max_prio = find_max(max_prio, prio); }