diff options
| author | Andy Wingo <wingo@pobox.com> | 2016-12-30 02:04:47 +0100 |
|---|---|---|
| committer | Andy Wingo <wingo@pobox.com> | 2016-12-30 02:10:02 +0100 |
| commit | 64fb236faa819ecc49ae7d32bbb41bef265ff2fd (patch) | |
| tree | a82f4cdac6520094b9717b63f8a7a231232e1837 /tests | |
| parent | Enable parallelism by default (diff) | |
| download | guile-fibers-64fb236faa819ecc49ae7d32bbb41bef265ff2fd.tar.gz | |
Fix spawn-fiber outside run-fibers
* fibers.scm (run-fibers): Require init thunk for run-fibers without a
scheduler.
(spawn-fiber): Incorporate helper procedures, remove dynamic-state
argument (as it's always the current dynamic state), and add parallel?
argument. Ensure the fiber will have the right read/write waiters.
* tests/basic.scm: Update.
Diffstat (limited to '')
| -rw-r--r-- | tests/basic.scm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/basic.scm b/tests/basic.scm index b3d92fa..ac1fa8a 100644 --- a/tests/basic.scm +++ b/tests/basic.scm @@ -65,7 +65,7 @@ (assert-equal #f #f) (assert-terminates #t) -(assert-terminates (run-fibers)) +(assert-equal #f (false-if-exception (begin (run-fibers) #t))) (assert-run-fibers-terminates (sleep 1)) (assert-run-fibers-terminates (do-times 1 (spawn-fiber (lambda () #t)))) (assert-run-fibers-terminates (do-times 10 (spawn-fiber (lambda () #t)))) @@ -73,6 +73,11 @@ (assert-run-fibers-terminates (do-times 1000 (spawn-fiber (lambda () #t)))) (assert-run-fibers-terminates (do-times 10000 (spawn-fiber (lambda () #t)))) (assert-run-fibers-terminates (do-times 100000 (spawn-fiber (lambda () #t)))) +(assert-run-fibers-terminates (do-times 100000 + (spawn-fiber (lambda () #t) #:parallel? #t))) +(define (loop-to-1e4) (let lp ((i 0)) (when (< i #e1e4) (lp (1+ i))))) +(assert-run-fibers-terminates (do-times 100000 (spawn-fiber loop-to-1e4))) +(assert-run-fibers-terminates (do-times 100000 (spawn-fiber loop-to-1e4 #:parallel? #t))) (assert-run-fibers-terminates (do-times 1 (spawn-fiber (lambda () (sleep 1))))) (assert-run-fibers-terminates (do-times 10 (spawn-fiber (lambda () (sleep 1))))) (assert-run-fibers-terminates (do-times 100 (spawn-fiber (lambda () (sleep 1))))) |
