[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Threads and blocking on interpreter input
From: |
Chris Double |
Subject: |
[Chicken-users] Threads and blocking on interpreter input |
Date: |
Sat, 5 Apr 2003 04:16:48 +1200 |
User-agent: |
KMail/1.4.3 |
I wanted to run some threads in the background while also using the
read-eval-print loop in the csi. While csi is waiting for input it blocks all
threads it seems (does this include threads waiting on tcp calls?).
As a workaround I came up with the following which allows threads to run in
the background while the listener is waiting for input:
(set! ##sys#read-prompt-hook
(lambda ()
(when (or (##sys#fudge 12) (##sys#tty-port?
(current-input-port)))
(display ">>> ")
(flush-output)
(##sys#thread-block-for-i/o! ##sys#current-thread 0
#t)
(thread-yield!))))
It's a hack, and probably won't work in all circumstances, but it worked for
what I needed to do. Is there a more robust way of doing this or are there
future plans for making terminal and file i/o not block threads?
Chris.
- [Chicken-users] Threads and blocking on interpreter input,
Chris Double <=