[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
about coroutines
From: |
Michele Bini |
Subject: |
about coroutines |
Date: |
Sun, 18 Nov 2001 03:07:58 +0100 |
I have been encountering some problems (segfaults) while testing
call/cc driven coroutines in guile. While coroutines are probably not
a commonly found programming paradigm nowadays, i wonder if this is
the symptom of some deeper problem regarding continuation support in
guile.
In this example the coroutine 'a' is a loop printing 3 4 5 6 in
succession, while 'b' prints 0 and 1 alternatively. After a few
seconds executing these loops, guile segfaults with no explicit error
message. Apparently there is some memory leak or stack allocation
problem going on (scm seems to share the same problem, by the way).
(define (coroutines-test)
(define x call-with-current-continuation)
(define w write)
(define (a y)
(define l (list 3 4 5 6))
(let loop ()
(for-each (lambda (a) (w a) (set! y (x y))) l)
(loop)))
(define (b y)
(let loop ((a 1)) (w a) (set! y (x y)) (loop (- 1 a))))
(let loop ((a a) (b b)) (loop (x a) (x b))))
;; simpler test, triggering the same problem
(define (coroutines-test2)
(define x call-with-current-continuation)
(define w write)
(define (a y)
(define l (list 1 2 3 4 5))
(let loop ()
(for-each (lambda (a) (w a) (set! y (x y))) l)
(loop)))
(let loop ((a a)) (loop (x a))))
Michele
- about coroutines,
Michele Bini <=
- Re: about coroutines, Keith Wright, 2001/11/18
- Re: about coroutines, Michele Bini, 2001/11/18
- Re: about coroutines, Keith Wright, 2001/11/18
- Re: about coroutines, Marius Vollmer, 2001/11/19
- Re: about coroutines, Keith Wright, 2001/11/19
- Re: about coroutines, Michele Bini, 2001/11/19
- Re: about coroutines, Marius Vollmer, 2001/11/21
- Re: about coroutines, Michele Bini, 2001/11/22
- Re: about coroutines, Marius Vollmer, 2001/11/29
- Re: about coroutines, mibin, 2001/11/30