diff --git a/basis/core-foundation/run-loop/run-loop.factor b/basis/core-foundation/run-loop/run-loop.factor index c334297122..39f4101301 100644 --- a/basis/core-foundation/run-loop/run-loop.factor +++ b/basis/core-foundation/run-loop/run-loop.factor @@ -1,7 +1,6 @@ ! Copyright (C) 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: alien.syntax kernel threads init namespaces alien -core-foundation calendar ; +USING: alien alien.syntax core-foundation kernel namespaces ; IN: core-foundation.run-loop : kCFRunLoopRunFinished 1 ; inline @@ -40,11 +39,3 @@ FUNCTION: void CFRunLoopAddSource ( "kCFRunLoopDefaultMode" dup \ CFRunLoopDefaultMode set-global ] when ; - -: run-loop-thread ( -- ) - CFRunLoopDefaultMode 0 f CFRunLoopRunInMode - kCFRunLoopRunHandledSource = [ 1 seconds sleep ] unless - run-loop-thread ; - -: start-run-loop-thread ( -- ) - [ run-loop-thread t ] "CFRunLoop dispatcher" spawn-server drop ; diff --git a/basis/core-foundation/run-loop/thread/thread.factor b/basis/core-foundation/run-loop/thread/thread.factor index 326226ec0e..aeeff312cb 100644 --- a/basis/core-foundation/run-loop/thread/thread.factor +++ b/basis/core-foundation/run-loop/thread/thread.factor @@ -1,8 +1,16 @@ ! Copyright (C) 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: init core-foundation.run-loop ; +USING: calendar core-foundation.run-loop init kernel threads ; IN: core-foundation.run-loop.thread ! Load this vocabulary if you need a run loop running. +: run-loop-thread ( -- ) + CFRunLoopDefaultMode 0 f CFRunLoopRunInMode + kCFRunLoopRunHandledSource = [ 1 seconds sleep ] unless + run-loop-thread ; + +: start-run-loop-thread ( -- ) + [ run-loop-thread t ] "CFRunLoop dispatcher" spawn-server drop ; + [ start-run-loop-thread ] "core-foundation.run-loop.thread" add-init-hook