From 21f45091d74f41b4684f059932981e4f585901fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renaud=20Casenave-P=C3=A9r=C3=A9?= Date: Sun, 2 Nov 2014 15:57:58 +0900 Subject: [PATCH] fix thread creation and deletion --- src/jobs.lisp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jobs.lisp b/src/jobs.lisp index 8a2e077..9252383 100644 --- a/src/jobs.lisp +++ b/src/jobs.lisp @@ -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)