$Header: /cvsroot/aolserver/aolserver.com/docs/devel/c/index.html,v 1.1 2002/03/07 19:15:35 kriston Exp $
typedef void (Ns_Callback) (void *context); Ns_ProcHandle Ns_RegisterAtExit( Ns_Callback *proc, void *context );
void* Ns_RegisterAtPreStartup ( Ns_Callback* proc, void* arg );
void* Ns_RegisterAtSignal ( Ns_Callback* proc, void* context );
void* Ns_RegisterAtStartup ( Ns_Callback* proc, void* context );
typedef void (Ns_Callback) (void *context); Ns_ProcHandle Ns_RegisterServerShutdown( char *hServer, Ns_Callback *proc, Ns_OpContext context );
typedef void (Ns_Callback) (void *context); Ns_ProcHandle Ns_RegisterShutdown( Ns_Callback *proc, void *context );
int Ns_TclRegisterAtCreate ( Ns_TclInterpInitProc* proc, void* arg );
void Ns_TclRegisterDeferred ( Tcl_Interp *interpPtr , Ns_TclDeferProc *deferProc , void *contex );
int Ns_ScheduleDaily( Ns_SchedProc *proc, void *context, int flags, int hour, int minute, Ns_SchedProc *cleanup );
The proc is the scheduled procedure that will be run once a day. 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 day. 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 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.
Run a procedure (MyProc) once in its own thread at 2:30 a.m.: Ns_ScheduleDaily(myProc, myCtx, NS_SCHED_ONCE | NS_SCHED_THREAD, 2, 30, NULL)
int Ns_ScheduleProc( void (*proc) (), void *context, int fNewThread, int interval );
Note that the newer Ns_ScheduleProcEx function provides a superset of the functionality in Ns_ScheduleProc.
int Ns_ScheduleProcEx( Ns_SchedProc *proc, void *context, int flags, int interval, Ns_SchedProc *cleanup );
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.
int Ns_ScheduleWeekly( Ns_SchedProc *proc, void *context, int flags, int day, int hour, int minute, Ns_SchedProc *cleanup );
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.
void Ns_UnscheduleProc ( int id );
int Ns_WaitForStartup (void);