[PATCH 2/2] mqueueopen.c: Changed thread release order to priority

Lou Woods irnhorse4 at gmail.com
Thu Aug 29 18:11:26 UTC 2019


From: Lou Woods <Lou.Woods at OARCorp.com>

Changed the POSIX message queue thread release order from
FIFO to priority per the Open Group Specification.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html

closes #3791.
---
 cpukit/posix/src/mqueueopen.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/cpukit/posix/src/mqueueopen.c b/cpukit/posix/src/mqueueopen.c
index 4bb8025..f613002 100644
--- a/cpukit/posix/src/mqueueopen.c
+++ b/cpukit/posix/src/mqueueopen.c
@@ -90,16 +90,22 @@ static mqd_t _POSIX_Message_queue_Create(
   the_mq->oflag = oflag;
 
   /*
-   *  NOTE: That thread blocking discipline should be based on the
-   *  current scheduling policy.
+   *  NOTE: That thread blocking discipline is priority based on text from the
+   *  Open Group cited below.  This is not a new requirement and was present
+   *  in the 1997 specification.
    *
-   *  Joel: Cite POSIX or OpenGroup on above statement so we can determine
-   *        if it is a real requirement.
+   *  mq_receive() Description Paragraph 4:
+   *    If more than one thread is waiting to receive a message when a message
+   *    arrives at an empty queue and the Priority Scheduling option is
+   *    supported, then the thread of highest priority that has been waiting
+   *    the longest shall be selected to receive the message.
+   *  http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html
+   *  The Open Group Base Specifications Issue 7, 2018 edition
    */
   if (
     !_CORE_message_queue_Initialize(
       &the_mq->Message_queue,
-      CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
+      CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY,
       attr->mq_maxmsg,
       attr->mq_msgsize
     )
-- 
1.8.3.1




More information about the devel mailing list