2008-01-28 07:02:26     xenomai: rt_event_wait with timeout wrong return value

Document created by Aaronwu Employee on Aug 5, 2013
Version 1Show Document
  • View in full screen mode

2008-01-28 07:02:26     xenomai: rt_event_wait with timeout wrong return value

Filip Van Rillaer (BELGIUM)

Message: 50222   

 

Hello,

 

rt_event_wait seems not to work properly if one specifies a timeout : the functioncall returns after the specified of time, but it returns 0, instead of -ETIMEDOUT.

 

Below is an example that demonstrates the problem.

 

Best regards,

 

Filip

 

#include <stdio.h>

#include <sys/mman.h>

#include <native/task.h>

#include <native/event.h>

 

#define EVENT_INIT        0x0           /* No flags present at init */

#define EVENT_MODE        EV_PRIO       /* Tasks will wait by priority order */

#define EVENT_WAIT_MASK   (0x1|0x2|0x4) /* List of monitored events */

 

 

RT_EVENT ev_desc;

int main(int argc, char **argv)

{

  RT_TASK task;

  unsigned long mask_ret;

  int err;

  RTIME timeout=13000000000LL; /* 13 sec */

 

  mlockall(MCL_CURRENT|MCL_FUTURE);

  rt_task_shadow(&task, "Task", 10, 0);

 

  err = rt_event_create(&ev_desc,"MyEventFlagGroup",EVENT_INIT, EVENT_MODE);

  if (err<0) {

    fprintf(stderr,"rt_event_create failed\n");

    return -1;

  }

  else {

    fprintf(stderr,"rt_event_create ok\n");

  }

 

  err = rt_event_wait(&ev_desc, EVENT_WAIT_MASK, &mask_ret, EV_ANY ,timeout);

  if (err<0) {

    switch (err)  {

      case -ETIMEDOUT: fprintf(stderr,"rt_event_wait returned -ETIMEDOUT (and that's OK)\n"); break;

      default:  fprintf(stderr,"rt_event_wait returned %d (which is wrong)\n",err); return -2;

    }

  }

  else {

    fprintf(stderr,"rt_event_wait returned 0, but we expected -ETIMEDOUT\n");

    return -3;

  }

  return 0;

}

TranslateQuoteReplyEditDelete

 

 

2008-01-29 00:02:19     Re: xenomai: rt_event_wait with timeout wrong return value

Yi Li (CHINA)

Message: 50261    I will run  your test.

QuoteReplyEditDelete

 

 

2008-01-29 05:11:13     Re: xenomai: rt_event_wait with timeout wrong return value

Yi Li (CHINA)

Message: 50267    Could you try to use 2008R1 branch, also xenomai-2.4.0?

 

Here is the result I got:

"root:/> ./test                                                                                            

rt_event_create ok                                                                                        

rt_event_wait returned -ETIMEDOUT (and that's OK)"

 

- Yi

QuoteReplyEditDelete

 

 

2008-01-29 05:44:08     Re: xenomai: rt_event_wait with timeout wrong return value

Filip Van Rillaer (BELGIUM)

Message: 50270   

 

Hello Yi,

 

Thank you for your help (and the person that fixed about 1 hour ago the xenomai-patch for the changes in gpio).  I will try the 2008R1 branch and go back to xenomai-2.4.0 (I was using the very latest version of xenomai in svn).  I will get back to you with my results.

 

Best regards, Filip

TranslateQuoteReplyEditDelete

 

 

2008-01-29 11:38:43     Re: xenomai: rt_event_wait with timeout wrong return value

Filip Van Rillaer (BELGIUM)

Message: 50319   

 

Hello Yi,

 

I tried xenomai-2.4.0 together with 2008R1 branch and my testprogram also works fine.

Then I combined xenomai-svn-latestversion together with 2008R1 branch and I get again the problem with the returnvalue.

So I went back to xenomai-2.4.0.

 

Is there a reason why the latest version of xenomai fails (I see that the library version has changed from libnative.so.1. to libnative.so.2, also when I tried to go back to version 2.4.0 without deleting the directories I got the error message <<incompatible ABI revision level>>)?

 

Best regards, Filip

 

 

 

 

 

 

TranslateQuoteReplyEditDelete

 

 

2008-01-29 21:57:23     Re: xenomai: rt_event_wait with timeout wrong return value

Yi Li (CHINA)

Message: 50340    >> Then I combined xenomai-svn-latestversion together with 2008R1 branch and I get again the problem with the returnvalue.

 

I did not track xenomai-svn, since the adeos patch for blackfin in xenomai-svn cannot be applied to 2008R1 (2008R1 is using linux-2.6.22). (In the future, when the blackfin uclinux-dist svn trunk is updated to 2.6.24, we might use xenomai-svn then).

 

>> Is there a reason why the latest version of xenomai fails

This looks like a bug. You may report to xenomai mailing list.

QuoteReplyEditDelete

 

 

2008-01-30 03:50:32     Re: xenomai: rt_event_wait with timeout wrong return value

Filip Van Rillaer (BELGIUM)

Message: 50345   

 

Hello Yi,

 

Thank you for your help.  I will continue to use the xenomai2.4.0 version.

I logged the problem on the adeos project : <http://gna.org/bugs/?10925>

 

Thanks, Filip

Attachments

    Outcomes