C API Reference -- Ns_ScheduleProcEx

### Ns_ScheduleProcEx

#### Overview

Schedule a procedure to run at specified intervals

#### Syntax

        int Ns_ScheduleProcEx(
        Ns_SchedProc *proc,
        void *context,
        int flags,
        int interval,
        Ns_SchedProc *cleanup
        );

#### Description

The Ns_ScheduleProcEx function schedules the procedure (`proc`) to be run at a specific time interval specified in seconds. Ns_ScheduleProcEx returns an integer id for use in the Ns_UnscheduleProc function.

The `proc` procedure is the scheduled procedure that will be run at each interval. 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. 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 `interval` is the number of seconds between runs of the procedure.

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

Top of Page
Copyright © 1998-99 America Online, Inc.