1.0.37.18: New contrib SB-CONCURRENCY.
[sbcl.git] / contrib / sb-concurrency / tests / test-utils.lisp
1 (in-package :sb-concurrency-test)
2
3 #+sb-thread
4 (progn
5
6 (defparameter +timeout+ 60.0)
7
8 (defun make-threads (n name fn)
9   (loop for i from 1 to n
10         collect (make-thread fn :name (format nil "~A-~D" name i))))
11
12 (defun timed-join-thread (thread &optional (timeout +timeout+))
13   (sb-sys:with-deadline (:seconds timeout)
14     (join-thread thread :default :aborted)))
15
16 (defun hang ()
17   (join-thread *current-thread*))
18
19 (defun kill-thread (thread)
20   (when (thread-alive-p thread)
21     (ignore-errors
22       (terminate-thread thread))))
23
24 ) ;; #+sb-thread (progn ...