![]() | ![]() | ![]() | make-scheduled-function | ![]() |
|
| function
&key name name-test marker marker-test | [Function] |
Purpose
Create a scheduled function.
Package :portable-threads
Module :portable-threads
Arguments and values
| function | A function designator specifying a function object of one argument | |
| name | An object (typically a
string or a symbol; default is nil)
| |
| name-test | A function of two arguments that returns a
generalized boolean (default is #'eql | |
| marker | An object (default is nil)
| |
| marker-test | A function of two arguments that returns a
generalized boolean (default is #'eql | |
| scheduled-function | A scheduled function |
Returns
The newly created scheduled function.
Errors
Threads (multiprocessing) is not supported on the
Common Lisp implementation.
Description
Unless the run time to perform
The optional marker and associated comparison marker-test can
be specified to distinguish scheduled functions with the same
name in calls to
See also
*schedule-function-verbose*
all-scheduled-functions
pause-scheduled-function-scheduler
restart-scheduled-function-scheduler
resume-scheduled-function-scheduler
schedule-function
schedule-function-relative
scheduled-function-marker
scheduled-function-marker-test
scheduled-function-name
scheduled-function-name-test
scheduled-function-repeat-interval
scheduled-function-scheduler-paused-p
scheduled-function-scheduler-running-p
spawn-periodic-function
unschedule-function
Examples
Create a scheduled function that simply prints "Hello"
> (make-scheduled-function
#'(lambda (scheduled-function)
(declare (ignore scheduled-function))
(print "Hello"))
:name 'hello)
#<scheduled-function hello [unscheduled]>
>
A more complex scheduled function that spawns a new thread to do its work and randomly sets whether to reschedule itself (and at what interval):
> (defun complex-function (scheduled-function)
(let ((interval (random 100)))
(setf (scheduled-function-repeat-interval scheduled-function)
(if (plusp interval)
;; repeat 1-99 seconds from now:
interval
;; don't repeat 1% of the time:
nil)))
(spawn-thread "Lots of stuff doer" #'do-lots-of-stuff))
complex-function
> (make-scheduled-function 'complex-function)
#<scheduled-function complex-function [unscheduled]>
>
The GBBopen Project
![]() | ![]() | ![]() | make-scheduled-function | ![]() |