io.thread: if the I/O thread throws an error, call out to the fep immediately instead of going through the normal thread error mechanism, which by that point won't work anyway

db4
Slava Pestov 2011-08-25 21:36:57 -07:00
parent 01eeabbcbd
commit dfc7326413
1 changed files with 13 additions and 4 deletions

View File

@ -7,13 +7,22 @@ IN: io.thread
! over completely.
SYMBOL: io-thread-running?
: io-thread ( -- )
sleep-time io-multiplex yield ;
TUPLE: io-thread < thread ;
: <io-thread> ( -- thread )
[
[ io-thread-running? get-global ]
[ sleep-time io-multiplex yield ]
while
]
"I/O wait"
io-thread new-thread ;
M: io-thread error-in-thread [ die ] call( error thread -- ) ;
: start-io-thread ( -- )
t io-thread-running? set-global
[ [ io-thread-running? get-global ] [ io-thread ] while ]
"I/O wait" spawn drop ;
<io-thread> (spawn) ;
: stop-io-thread ( -- )
f io-thread-running? set-global ;