From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10097 invoked by alias); 20 Jun 2005 18:49:46 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 10044 invoked by uid 22791); 20 Jun 2005 18:49:25 -0000 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 20 Jun 2005 18:49:25 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1DkRKl-0004KE-00 from Khurram_Ali@mentor.com ; Mon, 20 Jun 2005 11:49:23 -0700 Received: from SVR-ALH-EXC-02.mgc.mentorg.com ([134.86.109.198]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 20 Jun 2005 11:49:23 -0700 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Date: Mon, 20 Jun 2005 18:49:00 -0000 Message-ID: <32A0F6EE19ECF646A9CF370C3AB15EBE016A8AF5@SVR-ALH-EXC-02.mgc.mentorg.com> From: "Ali, Khurram" To: "Andrew Lunn" Cc: "eCos Discussion" Subject: RE: [ECOS] POSIX Queue Suspension X-SW-Source: 2005-06/txt/msg00180.txt.bz2 > 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,=20 > then the thread of highest priority that has been waiting the longest=20 > shall be selected to receive the message. Thread L is the highest priority thread that has been waiting the longest. Shouldn't it be resumed first? Agreed that other threads also have the same priority, but since there is an additional restriction of "waiting the longest" I would assume that we can have two or more threads at the same priority? Am I missing something? Khurram -----Original Message----- From: Andrew Lunn [mailto:andrew@lunn.ch]=20 Sent: Monday, June 20, 2005 12:22 PM To: Ali, Khurram Cc: eCos Discussion Subject: Re: [ECOS] POSIX Queue Suspension On Mon, Jun 20, 2005 at 10:54:00AM -0500, Ali, Khurram wrote: > Hello, >=20 > 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.=20 >=20 > All threads have the same priority. All queue accesses are also made > with the same priority. Shouldn't Thread L be resumed first.=20 >=20 > What could I be doing wrong? You don't seem to of read the POSIX standard.=20 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