From 328879638bf0284006596cce3f4a1d2a95ddfbdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renaud=20Casenave-P=C3=A9r=C3=A9?= Date: Wed, 22 Oct 2014 10:25:58 +0900 Subject: [PATCH] fix job::wait-for-next-job to properly return the next available job --- src/jobs.lisp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jobs.lisp b/src/jobs.lisp index 6c69a85..8a2e077 100644 --- a/src/jobs.lisp +++ b/src/jobs.lisp @@ -11,6 +11,7 @@ :thread :containers) (:export :job + :job-result :push-job :wait-for-job :cancel-job)) @@ -102,7 +103,7 @@ Returns t if the job has completed, nil otherwise." (and waitp (with-mutex ((job-mutex job)) (if timeout - (condition-wait(job-waitqueue job) (job-mutex job) :timeout timeout) + (condition-wait (job-waitqueue job) (job-mutex job) :timeout timeout) (loop until (job-completed job) do (condition-wait (job-waitqueue job) (job-mutex job)))) (job-completed job))))) @@ -149,7 +150,8 @@ Return t if job has been successfully canceled, nil if it currently running." (condition-wait waitqueue lock) (when (peek job-list) (setf job (dequeue job-list)) - (setf (job-running job) t))))) + (setf (job-running job) t)) + job))) (defun thread-loop (thread) "Run the thread loop.