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