Re: disappearing threads

Marius Vollmer (mvo@zagadka.ping.de)
06 Jun 1997 17:06:40 +0200

Aleksandar Bakic <bakicale@cps.msu.edu> writes:
>
> Since I still have threads that disappear (even though I fixed some
> related bugs), [...]

Some of my threads started to disappear, too. I investigated this and
came to the following (surprising?) interpretation:

The Scheme evaluator (eval) is not reentrant while memoizing source
code. This leads to subtle errors. But these errors are silently
dropped on the floor by make-thread and begin-thread.

To illustrate, try this ("x.scm"):

(use-modules (ice-9 threads))

(define (foo)
(let ((x 12))
(let ((x 12))
(let ((x 12))
(let ((x 12))
(let ((x 12))
(let ((x 12))
(let ((x 12))
(let ((x 12))
(display "foo!\n"))))))))))

(begin
(make-thread foo)
(foo))

Running it with "guile -s x.scm" produces

guile: bad bindings

(at least for me, it's highly likely that the timings are different
for you)

When the last three lines are changed into

(begin
(foo)
(make-thread foo))

everything is fine and the output is

foo!
foo!

as expected.

- Marius