src/ppe/pk/kernel/pk_timer_core.c
/// Schedule a timer for an interval relative to the current time.
///
/// \param timer The PkTimer to schedule.
///
/// \param interval The timer will be scheduled to time out at the current
/// time (pk_timebase_get()) plus this \a interval.
///
/// Once created with pk_timer_create() a timer can be \e scheduled, which
/// queues the timer in the kernel time queue.  It is not an error to call \c
/// pk_timer_schedule() on a timer that is already scheduled in the time
/// queue - the timer is simply rescheduled with the new characteristics.
///
/// Return values other than PK_OK (0) are errors; see \ref pk_errors
///
/// \retval 0 Successful completion
///
/// \retval -PK_INVALID_TIMER_AT_SCHEDULE A a null (0) pointer was provided as 
/// the \a timer argument.
///
Schedule a timer for an interval relative to the current time.
\param timer The PkTimer to schedule.

\param interval The timer will be scheduled to time out at the current
time (pk_timebase_get()) plus this \a interval.

Once created with pk_timer_create() a timer can be \e scheduled, which
queues the timer in the kernel time queue.  It is not an error to call \c
pk_timer_schedule() on a timer that is already scheduled in the time
queue - the timer is simply rescheduled with the new characteristics.

Return values other than PK_OK (0) are errors; see \ref pk_errors

\retval 0 Successful completion

\retval -PK_INVALID_TIMER_AT_SCHEDULE A a null (0) pointer was provided as
the \a timer argument.
Schedule a timer for an interval relative to the current time . \ param timer The PkTimer to schedule . \ param interval The timer will be scheduled to time out at the current time ( pk_timebase_get () ) plus this \ a interval . Once created with pk_timer_create () a timer can be \ e scheduled which queues the timer in the kernel time queue . It is not an error to call \ c pk_timer_schedule () on a timer that is already scheduled in the time queue - the timer is simply rescheduled with the new characteristics . Return values other than PK_OK ( 0 ) are errors ; see \ ref pk_errors \ retval 0 Successful completion \ retval - PK_INVALID_TIMER_AT_SCHEDULE A a null ( 0 ) pointer was provided as the \ a timer argument .
int
pk_timer_schedule(PkTimer    *timer, 
                   PkInterval interval)
{
    PkMachineContext ctx;
    PkTimebase  timeout = pk_timebase_get() + PK_INTERVAL_SCALE(interval);
    pk_critical_section_enter(&ctx);
    if (PK_ERROR_CHECK_API) {
        PK_ERROR_IF(timer == 0, PK_INVALID_TIMER_AT_SCHEDULE);
    }
    timer->timeout = timeout;
    __pk_timer_schedule(timer);
    pk_critical_section_exit(&ctx);
    return PK_OK;
}
int pk_timer_schedule ( PkTimer * timer , PkInterval interval ) { PkMachineContext ctx ; PkTimebase timeout = pk_timebase_get ( ) + PK_INTERVAL_SCALE ( interval ) ; pk_critical_section_enter ( & ctx ) ; if ( PK_ERROR_CHECK_API ) { PK_ERROR_IF ( timer == 0 , PK_INVALID_TIMER_AT_SCHEDULE ) ; } timer -> timeout = timeout ; __pk_timer_schedule ( timer ) ; pk_critical_section_exit ( & ctx ) ; return PK_OK ; }
Schedule a timer for an interval relative to the current time.
Schedule a timer for an interval relative to the current time .