Add a way to stop the io thread
parent
50a78db9bd
commit
bb45fa93a7
|
@ -1,14 +1,20 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: threads io.backend namespaces init math kernel ;
|
||||||
IN: io.thread
|
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 ( -- )
|
: io-thread ( -- )
|
||||||
sleep-time io-multiplex yield ;
|
sleep-time io-multiplex yield ;
|
||||||
|
|
||||||
: start-io-thread ( -- )
|
: start-io-thread ( -- )
|
||||||
[ io-thread t ]
|
[ [ io-thread-running? get-global ] [ io-thread ] [ ] while ]
|
||||||
"I/O wait" spawn-server
|
"I/O wait" spawn drop ;
|
||||||
\ io-thread set-global ;
|
|
||||||
|
|
||||||
[ start-io-thread ] "io.thread" add-init-hook
|
[
|
||||||
|
t io-thread-running? set-global
|
||||||
|
start-io-thread
|
||||||
|
] "io.thread" add-init-hook
|
||||||
|
|
Loading…
Reference in New Issue