message queue error - VxWorks

This is a discussion on message queue error - VxWorks ; i defined two tasks--taskOne and taskTwo.taskOne sends message "i love vxworks",taskTwo recesive the message ,if recesives sucessfully,printf the message.but when i execute them,there are alarm in the shell.the alram is listed below: instruction access Exception next instruction address: 0xeeeeeeec Machine ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: message queue error

  1. message queue error

    i defined two tasks--taskOne and taskTwo.taskOne sends message "i love
    vxworks",taskTwo recesive the message ,if recesives sucessfully,printf
    the message.but when i execute them,there are alarm in the shell.the
    alram is listed below:

    instruction access
    Exception next instruction address: 0xeeeeeeec
    Machine Status Register: 0x08209030
    Condition Register: 0x00000000
    Task: 0x7027c8 "t1"

    instruction access
    Exception next instruction address: 0xeeeeeeec
    Machine Status Register: 0x08209030
    Condition Register: 0x00000000
    Task: 0x6fd790 "t2"

    all of my code is listed below:

    void message(void)
    {
    int taskIdOne,taskIdTwo;

    if(mesgQueueId=(msgQCreate(MAX_MESSAGES,MAX_MESSAG E_LENGTH,MSG_Q_FIFO))==NULL)
    printf("msgQCreate in failed.\n");

    if((taskIdOne=taskSpawn("t1",90,0x100,2000,(FUNCPTR)taskIdOne,0,0,0,0,0,0,0,0, 0,0))==ERROR)
    printf("taskSpawn taskOne failed.\n");


    if((taskIdTwo=taskSpawn("t2",90,0x100,2000,(FUNCPTR)taskIdTwo,0,0,0,0,0,0,0,0, 0,0))==ERROR)
    printf("taskSpawn taskIdTwo failed.\n");
    }

    void taskOne(void)
    {
    char message[]="i love vxworks";

    if((msgQSend(mesgQueueId,message,MAX_MESSAGE_LENGT H,WAIT_FOREVER,MSG_PRI_NORMAL))==ERROR)
    printf("msgQSend in taskOne failed.\n");
    }

    void taskTwo(void)
    {
    char msgBuf[MAX_MESSAGE_LENGTH];

    if((msgQReceive(mesgQueueId,msgBuf,MAX_MESSAGE_LEN GTH,WAIT_FOREVER))==ERROR)
    printf("msgQReceive in taskTwo failed.\n");
    else
    printf("%s\n",msgBuf);

    msgQDelete(mesgQueueId);
    }

    why does the taskTwo not recesive the message "i love vxworks"?? and
    what's the meaning of the alarm error in shell??


  2. Re: message queue error

    Try:

    msgQSend(mesgQueueId,message,strlen(message)+1,WAI T_FOREVER,MSG_PRI_NORMAL)

    You are sending MAX_MESSAGE_LENGTH which may be longer than the string.

    --


    Regards,


    Graham Baxter
    Freelance Software Engineer (VxWorks, Linux and pSOS BSPs) - AVAILABLE SOON
    FOR A NEW ASSIGNMENT
    Graham Baxter (Software) Limited
    http://www.gbsw.co.uk
    fromnewsgrp@NOSPAMgbsw.co.uk



    wrote in message
    news:1136391325.104739.266870@g47g2000cwa.googlegr oups.com...
    >i defined two tasks--taskOne and taskTwo.taskOne sends message "i love
    > vxworks",taskTwo recesive the message ,if recesives sucessfully,printf
    > the message.but when i execute them,there are alarm in the shell.the
    > alram is listed below:
    >
    > instruction access
    > Exception next instruction address: 0xeeeeeeec
    > Machine Status Register: 0x08209030
    > Condition Register: 0x00000000
    > Task: 0x7027c8 "t1"
    >
    > instruction access
    > Exception next instruction address: 0xeeeeeeec
    > Machine Status Register: 0x08209030
    > Condition Register: 0x00000000
    > Task: 0x6fd790 "t2"
    >
    > all of my code is listed below:
    >
    > void message(void)
    > {
    > int taskIdOne,taskIdTwo;
    >
    > if(mesgQueueId=(msgQCreate(MAX_MESSAGES,MAX_MESSAG E_LENGTH,MSG_Q_FIFO))==NULL)
    > printf("msgQCreate in failed.\n");
    >
    > if((taskIdOne=taskSpawn("t1",90,0x100,2000,(FUNCPTR)taskIdOne,0,0,0,0,0,0,0,0, 0,0))==ERROR)
    > printf("taskSpawn taskOne failed.\n");
    >
    >
    > if((taskIdTwo=taskSpawn("t2",90,0x100,2000,(FUNCPTR)taskIdTwo,0,0,0,0,0,0,0,0, 0,0))==ERROR)
    > printf("taskSpawn taskIdTwo failed.\n");
    > }
    >
    > void taskOne(void)
    > {
    > char message[]="i love vxworks";
    >
    > if((msgQSend(mesgQueueId,message,MAX_MESSAGE_LENGT H,WAIT_FOREVER,MSG_PRI_NORMAL))==ERROR)
    > printf("msgQSend in taskOne failed.\n");
    > }
    >
    > void taskTwo(void)
    > {
    > char msgBuf[MAX_MESSAGE_LENGTH];
    >
    > if((msgQReceive(mesgQueueId,msgBuf,MAX_MESSAGE_LEN GTH,WAIT_FOREVER))==ERROR)
    > printf("msgQReceive in taskTwo failed.\n");
    > else
    > printf("%s\n",msgBuf);
    >
    > msgQDelete(mesgQueueId);
    > }
    >
    > why does the taskTwo not recesive the message "i love vxworks"?? and
    > what's the meaning of the alarm error in shell??
    >




+ Reply to Thread