cs & thread: fix chaperone-evt on will executors

Closes #2730
This commit is contained in:
Matthew Flatt 2019-07-09 13:48:30 -06:00
parent 8c052df959
commit 0284bdaa58
2 changed files with 26 additions and 1 deletions

View File

@ -66,6 +66,32 @@
(arity-test will-execute 1 1)
(arity-test will-try-execute 1 2)
;; ----------------------------------------
;; Will executors as events
(let ([we (make-will-executor)])
(let loop ([n 10])
(unless (zero? n)
(will-register we (cons n null)
(lambda (s)
(set! counter (cons (car s) counter))
12))
(loop (sub1 n))))
(collect-garbage)
(test we sync/timeout #f we)
(define evt-checked 0)
(define val-checked 0)
(test we sync/timeout #f (chaperone-evt we
(lambda (e)
(test #t eq? we e)
(set! evt-checked (add1 evt-checked))
(values e (lambda (val)
(test #t eq? we e)
(set! val-checked (add1 val-checked))
val)))))
(test '(1 1) list evt-checked val-checked))
;; ----------------------------------------
;; Test custodian boxes

View File

@ -17,7 +17,6 @@
will-execute)
(struct will-executor (host-we sema)
#:authentic
#:property prop:evt (lambda (we)
(wrap-evt (semaphore-peek-evt (will-executor-sema we))
(lambda (v) we))))