chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] an ode to Spiffy


From: felix winkelmann
Subject: Re: [Chicken-users] an ode to Spiffy
Date: Thu, 26 May 2005 08:46:05 +0200

On 5/25/05, Dominique Boucher <address@hidden> wrote:
> 
> > I can run
> > spiffy in a separate thread, add resources from the REPL, see
> 
> How do you do that? Spiffy must be started in a separate thread, but it
> seems that the REPL blocks all other threads (at least under cygwin,
> AFAICT). I need to issue a (thread-sleep! 10) when I want to test a new
> resource handler. Am I missing something obvious?
> 

Hm. Could you try this, please:

$ cat repltest.scm
 (use srfi-18)

 (set! ##sys#read-prompt-hook
    (let ([old ##sys#read-prompt-hook]
          [thread-yield! thread-yield!] )
      (lambda ()
        (when (or (##sys#fudge 12) (##sys#tty-port? ##sys#standard-input))
          (old)
          (##sys#thread-block-for-i/o! ##sys#current-thread 0 #t)
          (thread-yield!)))) ) 

(repl)  
$ csc repltest.scm
$ ./repltest
#;> (thread-start! (lambda () (let loop ((i 0)) (print i)
(thread-sleep! 1) (loop (add1 i)))))
; from now on you should still be able to eval expressions...

[This is normally done in srfi-18.scm, but is disabled on Windows.
Should this work with cygwin (requires select(2)), I'll disable it
exclusively for Windows/MSVC (which doesn't have select(2) on
file/stdio fd's)]


cheers,
felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]