|
|
|
@ -9,9 +9,9 @@
|
|
|
|
|
(define (make-runner program [calling-thd (current-thread)])
|
|
|
|
|
(thread (λ ()
|
|
|
|
|
(define regs (string->regs program))
|
|
|
|
|
(define (maybe-enlarge-regs len)
|
|
|
|
|
(unless (< len (vector-length regs))
|
|
|
|
|
(define newvec (make-vector (add1 len) 0))
|
|
|
|
|
(define (maybe-enlarge-regs ptr)
|
|
|
|
|
(unless (< ptr (vector-length regs))
|
|
|
|
|
(define newvec (make-vector (add1 ptr) 0))
|
|
|
|
|
(vector-copy! newvec 0 regs)
|
|
|
|
|
(set! regs newvec))
|
|
|
|
|
regs)
|
|
|
|
@ -64,10 +64,8 @@
|
|
|
|
|
(define thd (match program-or-thread
|
|
|
|
|
[(? thread? thd) thd]
|
|
|
|
|
[program (make-runner program)]))
|
|
|
|
|
(let loop ([acc null])
|
|
|
|
|
(match (thread-receive)
|
|
|
|
|
['done (reverse acc)]
|
|
|
|
|
[msg (loop (cons msg acc))])))
|
|
|
|
|
(for/list ([val (in-producer thread-receive 'done)])
|
|
|
|
|
val))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(check-equal?
|
|
|
|
|