Add a way to stop the io thread
parent
50a78db9bd
commit
bb45fa93a7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue