From 6edb771d05ec2626b53196816d419451f93b82d6 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 8 Dec 2008 16:01:11 -0600 Subject: [PATCH] Re-arrange some code so that core-foundation.run-loop no longer depends on calendar --- basis/core-foundation/run-loop/run-loop.factor | 11 +---------- basis/core-foundation/run-loop/thread/thread.factor | 10 +++++++++- 2 files changed, 10 insertions(+), 11 deletions(-) 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