fix thread creation and deletion

This commit is contained in:
Renaud Casenave-Péré 2014-11-02 15:57:58 +09:00
parent b9223e2e90
commit 21f45091d7

View file

@ -48,7 +48,7 @@
(defun make-job-thread (fun id &optional args)
"Create a new thread."
(let* ((thread-object (%make-thread :id id))
(thread (make-thread fun :name (format nil "Thread ~a" id) :args (list thread-object))))
(thread (make-thread fun :name (format nil "Thread ~a" id) :args (append (list thread-object) args))))
(setf (thread-thread thread-object) thread)
thread-object))
@ -132,7 +132,7 @@ Return t if job has been successfully canceled, nil if it currently running."
(let ((thread-id (thread-id thread)))
(format t "Finalize thread ~a~%" thread-id)
(join-thread (thread-thread thread) :default 'join-error)
(if (and nil (not (thread-termination-requested thread)))
(if (not (thread-termination-requested thread))
;; If the thread wasn't requested to terminate, something wrong happened, restart a new one
(let ((new-thread (make-job-thread #'thread-loop thread-id)))
(push-command #'initialize-thread nil new-thread)