M. Koehrer wrote: > Hi Dennis, > > I have just detected the very same effect. At least with RTAI-3.3cv it is not > working. > In rtnet's rt_udp_recvmsg() > the timeout will be set to -1 if the flag MSG_DONTWAIT is used. > > The call to rtdm_sem_timeddown() with this timeout value fails as the > resulting RTAI > function _sem_wait_timed rejects a negative timeout => it returns > -EWOULDBLOCK immediately > without checking the semaphores value. > RTDM in RTAI seems not to handle a polling semaphore check correctly. > That means the only possible way (without changing rtdm) is to it the way you > have done it: > Using a extreme small timeout value (=1). > > By looking at the code I saw same strange things: > In rtnet, the time type nanosecs_t is a uint64, however in RTAI's rtdm the > timetype is a signed int64. > That could lead to confusion... > > To fix the MSG_DONTWAIT issue I have detected, the code can be modified to > set the timeout > to 1 (instead of -1) whenever MSG_DONTWAIT is specified. >
Negative timeouts produce -EWOULDBLOCK in the original implementation of RTDM also. The difference is that there the sem count check is anticipated and the count simply decremented with immediate return if it is greater than zero. RTAI checks for -EWOULDBLOCK before and so it does not call its timed sem_wait, where the sem count will be decremented, withoutn any timeout, if it is greater then zero. So it will behave as expected. Clearly the solution woulfd be to use 0, but it cannot, as zero indicates an infinite delay in RTDM. So one (nanosec) has to be the compromise. Notice it will never produce any delay, either because sem count is greater than zero or because it is too low a value and RTAI will timeout immediately anyhow, as it is never worth to have to reschedule for a single nanosec. Paolo. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ RTnet-users mailing list RTnet-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rtnet-users