Hello Arnaud,

> But it's not working properly: What I observe is that when I change a
> procedure that's called from the background thread, the thread becomes
> blocked. Is this some new behaviour that's not taken into account in
> those posts?

It's tricky to reproduce such issues without a minimal repro. I wrote my
own and I do not experience such behavior. When I run the attached file
with `csi -:x test.scm`, I see it printing 1 every 10s. I can then
copy-paste `(define (game-loop-iteration) (print 2))` into the REPL and
if I wait another 10 seconds, it prints 2. Do you have the same
behavior? If yes, then chances are it's the fault of the code change
(for example it might perform a thread blocking operation).

> $ csi -version
> CHICKEN
> (c) 2008-2020, The CHICKEN Team
> (c) 2000-2007, Felix L. Winkelmann
> Version 5.2.0 (rev 317468e4)
> macosx-unix-clang-x86-64 [ 64bit dload ptables ]
> 
> I am on Mac OS X Catalina 10.15.7.

I'm on the same CHICKEN version, but on Arch Linux.

Vasilij
(import scheme)
(import (chicken base))
(import (srfi 18))

(define (game-loop-iteration)
  (print 1))

(define (main)
  (let loop ()
    (game-loop-iteration)
    (thread-sleep! 10)
    (loop)))

(define game-thread (thread-start! main))

(cond-expand
 ((or chicken-script compiling)
  (thread-join! game-thread))
 (else))

(cond-expand
 (csi (import live-define))
 (else))

#;
(when (eqv? 'terminated (thread-state game-thread))
  (set! game-thread (thread-start! main)))

Attachment: signature.asc
Description: PGP signature

Reply via email to