[noctool-cvs] CVS source
imattsson
imattsson at common-lisp.net
Wed Aug 13 05:56:30 UTC 2008
Update of /project/noctool/cvsroot/source
In directory clnet:/tmp/cvs-serv14717
Modified Files:
scheduler.lisp
Log Message:
IM
Added a scheduler loop and a control variable.
--- /project/noctool/cvsroot/source/scheduler.lisp 2008/07/09 14:40:06 1.5
+++ /project/noctool/cvsroot/source/scheduler.lisp 2008/08/13 05:56:29 1.6
@@ -2,6 +2,7 @@
(defvar *default-scheduler* nil)
(defvar *network-updates-needed* nil)
+(defvar *scheduler-loop-control* nil "Set to NIL to terminate a running scheduler loop")
(defclass event ()
((time :reader time :initarg :time)
@@ -146,3 +147,12 @@
(let ((obj (net.hexapodia.noctool-scheduler::object event)))
(when (or (proxies (equipment obj)) (proxies obj))
(push obj *network-updates-needed*))))
+
+(defun scheduler-loop ()
+ (setf *scheduler-loop-control* t)
+ (loop while *scheduler-loop-control*
+ do (let ((next (next-time)))
+ (cond ((null next) (sleep 60))
+ ((<= next (get-universal-time)) (process (next-timeslot)))
+ (t (sleep (min 1 (- next (get-universal-time))))
+ (process (next-timeslot)))))))
More information about the noctool-cvs
mailing list