[ Previous ] [ Contents ] [ Index ] [ Next ]



Schedule a procedure to run once a week


    int Ns_ScheduleWeekly(
    Ns_SchedProc *proc,
    void *context,
    int flags,
    int day,
    int hour,
    int minute,
    Ns_SchedProc *cleanup


The Ns_ScheduleWeekly function schedules the procedure (proc) to be run once a week on the specified day (day) at the specified time (hour and minute).

The proc procedure is the scheduled procedure that will be run once a week. It is a function that takes the context and id of the schedule procedure. The id can be used in the Ns_UnscheduleProc procedure to stop the procedure from being called again.

    typedef void (Ns_SchedProc) (void *context, int id);

The context is the context to pass to the scheduled procedure.

The possible flags are NS_SCHED_ONCE and NS_SCHED_THREAD. If you specify NS_SCHED_ONCE, the procedure will only be executed once on the specified day and time, and it will not be re-scheduled to execute again the next week. By default, the procedure is re-scheduled after every time it is executed.

If you specify NS_SCHED_THREAD, the procedure will run detached in a separate thread instead of using the one scheduled procedure thread used by all other scheduled procedures. You should use NS_SCHED_THREAD if the procedure will not return immediately. Note that if you use NS_SCHED_THREAD, and the procedure is still active the next time to run occurs, the next run is skipped instead of just delayed.

The day can be an integer from 0 to 6, where 0 represents Sunday. The hour can be an integer from 0 to 23, and the minute an integer from 0 to 59.

The cleanup procedure will be run once when the proc procedure is unscheduled.

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1998-99 America Online, Inc.