rtems select implementation
Eric Norum
wenorum at lbl.gov
Thu Sep 2 16:39:59 UTC 2010
The socket receive and send timeout options work on RTEMS.
If you have to wait on only one socket per thread this might be an option for you.
On Sep 2, 2010, at 9:30 AM, John Wood wrote:
> Greetings all,
>
>
> I have a question about the best way to implement something using the select function call, ideally I don't want to pull in the posix interface.
>
> I am porting ptpd, the precision time protocol for use with my board using rtems. My goal is to minimize modifications to the ptpd code base as much as possible. I ran into an interesting problem when I went from version 1 of the ptpd code to version 2. Specifically, in the original implementation the code calls select with a non null value for the timeout. Various timers are running in the background and when select would timeout it would check to see if the appropriate timeout had expired. Since there was a timeout in select this masked an issue with the rtems version of select. In version 2, the code was changed to have a null timeout. The linux implementation of the timers used signals so select would exit on the timer event. This was masked in my implementation.
>
> After figuring this out, I thought all I need to do was to send SB_WAIT to the task calling select from my timer callback. Easy enough, however in rtems select if the nothing is ready in any of the fd lists then the select function will simply call rtems_event_receive.
>
> I have a couple options here.
>
>
> 1. use posix and verify the signals work the same way
> 2. modify rtems_select, obviously not desired (any chance this is in the works?)
> 3. modify the ptpd interface to use timeouts
>
> Each has its own drawbacks
> 1. Posix...size, complexity and I am currently using rtems++ and native rtems everywhere else
> 2. Kindof nasty modifying the internals of rtems
> 3. having the timer trip select results in a more responsive system, also would like to keep the protocol engine for ptpd as close as possible.
>
> Any suggestions?
>
> Thanks a lot,
> John
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users
--
Eric Norum
wenorum at lbl.gov
More information about the users
mailing list