run-in-threadPortable Threadsschedule-function-relativeschedule-functionGoTo Top

schedule-function   name-or-scheduled-function invocation-time &key repeat-interval verbose[Function]

Purpose
Schedule a scheduled function at an absolute invocation time.

Package   :portable-threads

Module   :portable-threads

Arguments and values

name-or-scheduled-function     An object (typically a string or a symbol) naming a currently scheduled scheduled function or a scheduled-function object
invocation-time     A universal time
repeat-interval     A positive integer (representing seconds) or nil (default is nil)
verbose     A generalized boolean (default is *schedule-function-verbose*)

Errors
Threads (multiprocessing) is not supported on the Common Lisp implementation.

Description
If the scheduled-function object is unscheduled, it is added to the list of currently scheduled scheduled functions with the specified invocation-time and repeat-interval. If the scheduled-function object is currently scheduled, it is first unscheduled and then rescheduled with the specified invocation-time and repeat-interval.

See also
    *schedule-function-verbose*
    all-scheduled-functions
    encode-time-of-day
    make-scheduled-function
    restart-scheduled-function-scheduler
    schedule-function-relative
    scheduled-function-repeat-interval
    spawn-periodic-function
    unschedule-function

Examples
Schedule a scheduled function that simply prints "Happy New Year!" at midnight (local time) on January 1, 2010:

  > (schedule-function
      (make-scheduled-function
        #'(lambda (scheduled-function)
            (declare (ignore scheduled-function))
            (print "Happy New Year!")))
       (encode-universal-time 0 0 0 1 1 2010))
  > (all-scheduled-functions)
  (#<scheduled-function nil [Jan 1, 2010 00:00:00]>)
  >
Schedule a scheduled function that prints "It's quitting time!" every day at 5pm:
  > (schedule-function
      (make-scheduled-function
        #'(lambda (scheduled-function)
            (declare (ignore scheduled-function))
            (print "It's quitting time!"))
        :name 'quitting-time)
       (encode-time-of-day 17 0 0) :repeat-interval #.(* 24 60 60))
  >
Verbosely change quitting-time to 5:30pm every day:
  > (schedule-function 'quitting-time (encode-time-of-day 17 30 0)
      :repeat-interval #.(* 24 60 60)
      :verbose 't)
  ;; Unscheduling #<scheduled-function quitting-time [17:00:00]>...
  ;; Scheduling #<scheduled-function quitting-time [17:30:00]> 
  ;; as the next scheduled-function...
  >


The GBBopen Project


run-in-threadPortable Threadsschedule-function-relativeschedule-functionGoTo Top