Hook the job system to the module initialization process
This commit is contained in:
parent
146d58f591
commit
282ebf2f44
1 changed files with 5 additions and 0 deletions
|
|
@ -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)))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue