stoe/test/job-utils.lisp

20 lines
582 B
Common Lisp

#|
This file is a part of stoe project.
Copyright (c) 2015 Renaud Casenave-Péré (renaud@casenave-pere.fr)
|#
(uiop:define-package :stoe/test/job-utils
(:use :cl :prove
:stoe/core/jobs)
(:export #:with-new-job-thread))
(in-package :stoe/test/job-utils)
(defmacro with-new-job-thread (count &body body)
`(progn
(dotimes (i ,count)
(push-new-job-thread (format nil "Test thread ~d" i)))
,@body
(mapc (lambda (thread) (terminate-thread thread))
stoe/core/jobs::*thread-list*)
(sleep 0.5)
(stoe/core/jobs::update 0)))