$ gsc
Gambit v4.6.9
> (load "dump_threads.scm")
"/home/user/dump_threads.scm"
> (thread-start! (make-thread (lambda () (define myvar 1234) (thread-sleep! 5) (void)) 'first-thread))
#<thread #2 first-thread>
> (thread-start! (make-thread (lambda () (define myvar 5678) (thread-sleep! 5) (void)) 'second-thread))
#<thread #3 second-thread>
> (thread-yield!)
> (dump-threads #t 100 100)
#<thread #1 primordial>
0 loop "dump_threads.scm"@111:32 (with-exception-catcher (lambda (...
result = ##thread-void-action!
exception? = #f
end-condvar = '#<condition-variable #4 #f>
quantum-pre = .02
loop = (lambda () (letrec ((quantum-pre (thread-quantum (current-thread)))) (thread-quantum-...
thread = '#<thread #1 primordial>
display-environment = #t
max-head = 100
max-tail = 100
1 dump-thread "dump_threads.scm"@124:5 (out)
out = (lambda () ((letrec ((loop (lambda () (letrec ((quantum-pre (thread-quantum (current-t...
thread = '#<thread #1 primordial>
display-environment = #t
max-head = 100
max-tail = 100
2 for-each
3 (interaction) (console)@5:1 (dump-threads #t 100 100)
#<thread #2 first-thread>
0 ##thread-sleep!
1 #<procedure #5> (console)@2:60 (thread-sleep! 5)
myvar = 1234
2 ##thread-start-action!
#<thread #3 second-thread>
0 ##thread-sleep!
1 #<procedure #6> (console)@3:60 (thread-sleep! 5)
myvar = 5678
2 ##thread-start-action!
>