Hook the job system to the module initialization process

This commit is contained in:
Renaud Casenave-Péré 2014-01-05 12:43:14 +09:00
parent 146d58f591
commit 282ebf2f44

View file

@ -65,6 +65,9 @@
(loop while (some (lambda (elt) (not (null elt))) *thread-list*)
do (update 0)))
(add-hook modules:*initialize-hook* #'initialize)
(add-hook modules:*finalize-hook* #'finalize)
(defun push-job (fun args callback)
"Create a new job using `fun' and `data' and push it into the job-list."
(let ((job (make-job :handle (incf *next-handle*) :fun fun :args args :callback callback)))
@ -94,6 +97,8 @@ If a thread is available, assign a new job to it."
(funcall (job-callback job) (job-result job))
(dequeue *job-list*)))))))
(add-hook modules:*update-hook* #'update)
(defun initialize-thread (thread)
"Initialize a thread."
(format t "Initialize thread ~a~%" (thread-id thread)))