Add a way to stop the io thread

db4
Slava Pestov 2008-12-12 23:56:19 -06:00
parent 50a78db9bd
commit bb45fa93a7
1 changed files with 11 additions and 5 deletions

View File

@ -1,14 +1,20 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: threads io.backend namespaces init math kernel ;
IN: io.thread
USING: threads io.backend namespaces init math ;
! The Cocoa UI backend stops the I/O thread and takes over
! completely.
SYMBOL: io-thread-running?
: io-thread ( -- )
sleep-time io-multiplex yield ;
: start-io-thread ( -- )
[ io-thread t ]
"I/O wait" spawn-server
\ io-thread set-global ;
[ [ io-thread-running? get-global ] [ io-thread ] [ ] while ]
"I/O wait" spawn drop ;
[ start-io-thread ] "io.thread" add-init-hook
[
t io-thread-running? set-global
start-io-thread
] "io.thread" add-init-hook