3 (defvar *mutex* (sb-thread:make-mutex))
4 (defvar *waitq* (sb-thread:make-waitqueue))
7 (defgeneric process-job-in-system (job-system job))
9 (defun start-processor-thread ()
10 (sb-thread:make-thread
14 ((job (find :queued *all-job* :key #'job-status)))
17 ; We just wait here until the processor is released, which is usually done
18 ; when a project is refreshed.
19 (sb-thread:with-mutex (*mutex*)
20 (sb-thread:condition-wait *waitq* *mutex*))))))
23 (defun awaken-processor-thread ()
24 (sb-thread:with-mutex (*mutex*)
25 (sb-thread:condition-broadcast *waitq*)))
27 (defun process-job (job)
28 (set-job-status job :in-progress)
29 (git (job-project job) "checkout" (job-sha job))
30 (if (not (probe-file (format nil "~A.candle" (project-dir (job-project job)))))
31 (set-job-status job :no-candle-file)
32 (multiple-value-bind (result log) (process-job-in-system *job-system* job)
33 (set-job-status job (if result :succeeded :failed))
34 (set-job-log job log))))