[ECOS] RE: POSIX Queues

Ali, Khurram Khurram_Ali@mentor.com
Wed Apr 27 18:26:00 GMT 2005


As a follow up to this...I get linker error (undefined) when I use
mq_notify. I have all the other queue APIs available.

I would really appreciate any help.

Thank you,
Khurram

-----Original Message-----
From: Ali, Khurram 
Sent: Wednesday, April 27, 2005 11:11 AM
To: 'eCos Discussion'
Subject: POSIX Queues

Hi,

I am running the following application on an x86 platform:

mqd_t               Queue;

int main (void)
{
    char                send[100];
    char                recv[128];
    int                 priority;
    struct mq_attr      mqstat;
    int                 status;
    struct timespec     interval;

    
    /* Create queue.  */
    mqstat.mq_flags = 0;
    mqstat.mq_maxmsg = 1;
    mqstat.mq_msgsize = 100;

    Queue = mq_open("Queue",
                    (O_RDWR | O_CREAT),
                    0,
                    mqstat);
  
    if (Queue < 0)
    {
        printf ("Can not create Queue.\r\n");
    }

    interval.tv_sec = 10;
    interval.tv_nsec= 0;

    while(1)
    {
        /* Send to queue. */
        status  = mq_timedsend(Queue,
                          send,
                          100,
                          16,
                          &interval);
 

        if (status != 0)
        {
            printf("Can not send to queue. %i \r\n", status);
        }
        else
        {
            printf("\t Sent %i \r\n", status);
        }
        

        /* Receive from queue. */
        status = mq_timedreceive(Queue,
                                 recv,
                                 128,
                                 &priority,
                                 &interval);
 

        if (status < 0)
        {
            printf("Can not receive from queue. %i \r\n", status);
        }
        else
        {
            printf("\t Received %i \r\n", status);
        }
    }    
}

After sometime, I am unable to send or receive from queue. Does anyone
have any idea what could be wrong?

Thank you,
Khurram

---------------------------------------
M. Khurram Ali - khurram_ali@mentor.com 
Software Engineer

Accelerated Technology,
A Mentor Graphics Division

739 North University Blvd. 
Mobile, AL 36608

www.mentor.com/embedded
---------------------------------------


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



More information about the Ecos-discuss mailing list