fix thread creation and deletion
This commit is contained in:
parent
b9223e2e90
commit
21f45091d7
1 changed files with 2 additions and 2 deletions
|
|
@ -48,7 +48,7 @@
|
||||||
(defun make-job-thread (fun id &optional args)
|
(defun make-job-thread (fun id &optional args)
|
||||||
"Create a new thread."
|
"Create a new thread."
|
||||||
(let* ((thread-object (%make-thread :id id))
|
(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)
|
(setf (thread-thread thread-object) thread)
|
||||||
thread-object))
|
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)))
|
(let ((thread-id (thread-id thread)))
|
||||||
(format t "Finalize thread ~a~%" thread-id)
|
(format t "Finalize thread ~a~%" thread-id)
|
||||||
(join-thread (thread-thread thread) :default 'join-error)
|
(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
|
;; 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)))
|
(let ((new-thread (make-job-thread #'thread-loop thread-id)))
|
||||||
(push-command #'initialize-thread nil new-thread)
|
(push-command #'initialize-thread nil new-thread)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue