Depending on what it is doing, using time fire after might be a better option.

On Dec 20, 2013 1:52 PM, "Claus, Ric" <cl...@slac.stanford.edu> wrote:
A program that I’m trying to make compatible with RTEMS (iperf 2.0.5) uses the 
posix function setitimer(), which has only a trivial implementation under 
RTEMS.  I modified the code as follows:

    if ( mMode_Time ) {
        memset (&it, 0, sizeof (it));
        it.it_value.tv_sec = (int) (mSettings->mAmount / 100.0);
        it.it_value.tv_usec = (int) 10000 * (mSettings->mAmount -
            it.it_value.tv_sec * 100.0);
#ifndef __rtems__
        err = setitimer( ITIMER_REAL, &it, NULL );
        if ( err != 0 ) {
            perror("setitimer");
            exit(1);
        }
#else
        FAIL (mSettings->mAmount > UINT_MAX / 10000, "ualarm", mSettings);

        ualarm(mSettings->mAmount * 10000, 0);
#endif
    }

If implementing setitimer( ITIMER_REAL, … ) with ualarm() is a valid thing to 
do (please comment), would it be useful for me to provide a patch to 
setitimer() that operates this way?  I’m not sure whether in this scenario the 
alarm must be cancelled with alarm(0, 0) later or not, but that would prevent 
this from being a generic solution.

        Cheers,
                        Ric
_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel
_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to