-;;; Create threads waiting until a gate is opened, then open that
-;;; gate and assure that all waiters were waked up. Also make sure
-;;; that interrupting a thread waiting on a gate doesn't make it
-;;; cross the gate if it is closed.
-(deftest gate.1
- (let* ((gate (make-gate))
- (marks (make-array 100 :initial-element nil))
- (threads (loop for i from 0 below (length marks)
- collect (make-thread (lambda (n)
- (wait-on-gate gate)
- (setf (aref marks n) (cons n (aref marks n))))
- :arguments i)))
- (int-gate (make-gate)))
- (sleep 1)
- (interrupt-thread (car threads) (lambda ()
- (unwind-protect
- (when (gate-open-p gate)
- (sb-ext:quit))
- (open-gate int-gate))))
- (wait-on-gate int-gate)
- (assert (every #'null marks))
- (open-gate gate)
- (mapc #'join-thread threads)
- (dotimes (i (length marks))
- (assert (equal (list i) (aref marks i))))
- t)
- t)
+(deftest gate.0
+ (let ((gate (make-gate :open t)))
+ (values (wait-on-gate gate)
+ (close-gate gate)
+ (wait-on-gate gate :timeout 0.1)))
+ t
+ t
+ nil)