public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Ali, Khurram" <Khurram_Ali@mentor.com>
Cc: eCos Discussion <ecos-discuss@ecos.sourceware.org>
Subject: Re: [ECOS] POSIX Queue Suspension
Date: Mon, 20 Jun 2005 17:22:00 -0000	[thread overview]
Message-ID: <20050620172216.GF17597@lunn.ch> (raw)
In-Reply-To: <32A0F6EE19ECF646A9CF370C3AB15EBE016A8A7E@SVR-ALH-EXC-02.mgc.mentorg.com>

On Mon, Jun 20, 2005 at 10:54:00AM -0500, Ali, Khurram wrote:
> Hello,
> 
> I have two POSIX threads that are waiting to receive on a POSIX queue.
> Thread L suspends on the queue first. Thread K then suspends on the
> queue. However, when Thread J sends an element to the queue. Thread K is
> resumed first. 
> 
> All threads have the same priority. All queue accesses are also made
> with the same priority. Shouldn't Thread L be resumed first. 
> 
> What could I be doing wrong?

You don't seem to of read the POSIX standard. 

http://www.opengroup.org/onlinepubs/009695399/functions/mq_receive.html

If the specified message queue is empty and O_NONBLOCK is not set in
the message queue description associated with mqdes, mq_receive()
shall block until a message is enqueued on the message queue or until
mq_receive() is interrupted by a signal. 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. Otherwise, it is unspecified which waiting
thread receives the message. If the specified message queue is empty
and O_NONBLOCK is set in the message queue description associated with
mqdes, no message shall be removed from the queue, and mq_receive()
shall return an error.

So eCos behavious seems correct to me.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

  reply	other threads:[~2005-06-20 17:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-20 15:54 Ali, Khurram
2005-06-20 17:22 ` Andrew Lunn [this message]
2005-06-20 18:49 Ali, Khurram
2005-06-20 21:58 Ali, Khurram
2005-06-20 23:47 ` Gary Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050620172216.GF17597@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Khurram_Ali@mentor.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).