(sorry, I accidentally pressed ctrl+return, which caused my mail client to send the message).
So here's the code:
(for-each
(lambda(i)
(let ((thread (call-with-new-thread
(lambda ()
(sleep (+ (random 10) 2))
(format #t "woke ~a: ~a\n" (current-thread) i)))))
(format #t "created ~a: ~a\n" thread i)))
(iota 5))
It displays something like this (with the "woke" messages being displayed at some random instances of time, of course):
created #<thread 140077961983744 (d57000)>: 0
created #<thread 140077970376448 (e36400)>: 1
created #<thread 140077978769152 (e40c00)>: 2
created #<thread 140077995554560 (e40a00)>: 3
created #<thread 140077987161856 (e40800)>: 4
woke #<thread 140077970376448 (e36400)>: 1
woke #<thread 140077961983744 (d57000)>: 0
woke #<thread 140077978769152 (e40c00)>: 2
woke #<thread 140077995554560 (e40a00)>: 3
woke #<thread 140077987161856 (e40800)>: 4
So it seems that each thread keeps the value of the variable from the moment of its creation. This is fine (and perhaps that's the most reasonable behaviour), but I'm a little worried that I didn't manage to find it in the documentation, so I'm just writing to receive confirmation ;]