From 56d7869b60cca57df7be70338d7b95a85eb43f55 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 1 Nov 2007 15:20:11 -0500 Subject: [PATCH 1/4] Fix error printing for dlopen on windows --- vm/os-windows.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vm/os-windows.c b/vm/os-windows.c index 6e39422134..421d90b223 100755 --- a/vm/os-windows.c +++ b/vm/os-windows.c @@ -51,8 +51,7 @@ void ffi_dlopen (F_DLL *dll, bool error) { dll->dll = NULL; if(error) - general_error(ERROR_FFI,F,F, - (void*)tag_object(get_error_message())); + general_error(ERROR_FFI,F,tag_object(get_error_message()),NULL); else return; } From a609d192b6b6b3f4f485d027cbb57900f268591b Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 6 Nov 2007 08:56:54 -0600 Subject: [PATCH 2/4] Fix typo in installer script --- misc/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/install.sh b/misc/install.sh index baf05192ec..006a7cf604 100755 --- a/misc/install.sh +++ b/misc/install.sh @@ -112,7 +112,7 @@ check_ret wget if [[ $OS == windows-nt ]] ; then wget http://factorcode.org/dlls/freetype6.dll check_ret - wget http://factorcode.org/dlls/zlib1.dla + wget http://factorcode.org/dlls/zlib1.dll check_ret fi From e5b4177487e7af28bd98056cb8bb985f8b02d6e7 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 6 Nov 2007 15:51:50 -0600 Subject: [PATCH 3/4] Port alarms to the new modules system --- extra/alarms/alarms.factor | 87 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 extra/alarms/alarms.factor diff --git a/extra/alarms/alarms.factor b/extra/alarms/alarms.factor new file mode 100644 index 0000000000..4842f8b7ae --- /dev/null +++ b/extra/alarms/alarms.factor @@ -0,0 +1,87 @@ +! Copyright (C) 2007 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: arrays calendar combinators concurrency generic +init kernel math namespaces sequences threads ; +IN: alarms + +TUPLE: alarm time quot ; + +C: alarm + + 0 > ] curry* subset ; + +: unexpired-alarms ( -- seq ) + now alarms get-global + [ alarm-time <=> 0 <= ] curry* subset ; + +: call-alarm ( alarm -- ) + alarm-quot spawn drop ; + +: do-alarms ( -- ) + expired-alarms [ call-alarm ] each + unexpired-alarms alarms set-global ; + +: alarm-receive-loop ( -- ) + receive dup alarm? [ handle-alarm ] [ drop ] if + alarm-receive-loop ; + +: start-alarm-receiver ( -- ) + [ + alarm-receive-loop + ] spawn alarm-receiver set-global ; + +: alarm-loop ( -- ) + alarms get-global empty? [ + do-alarms + ] unless 100 sleep alarm-loop ; + +: start-alarm-looper ( -- ) + [ + alarm-loop + ] spawn alarm-looper set-global ; + +: send-alarm ( str alarm -- ) + over set-delegate + alarm-receiver get-global send ; + +: start-alarm-daemon ( -- ) + alarms get-global [ V{ } clone alarms set-global ] unless + start-alarm-looper + start-alarm-receiver ; + +[ start-alarm-daemon ] "alarms" add-init-hook +PRIVATE> + +: register-alarm ( alarm -- ) + "register" send-alarm ; + +: unregister-alarm ( alarm -- ) + "unregister" send-alarm ; + +: change-alarm ( alarm-old alarm-new -- ) + "register" send-alarm + "unregister" send-alarm ; + +! Example: +! 5 seconds from-now [ "hi" print flush ] register-alarm From 028668cc094720f71bb25af4129fe2ca9da5afa7 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 6 Nov 2007 21:04:01 -0600 Subject: [PATCH 4/4] Remove debugging print --- extra/concurrency/concurrency.factor | 1 - 1 file changed, 1 deletion(-) diff --git a/extra/concurrency/concurrency.factor b/extra/concurrency/concurrency.factor index 426ef617ca..1e9b769823 100644 --- a/extra/concurrency/concurrency.factor +++ b/extra/concurrency/concurrency.factor @@ -43,7 +43,6 @@ TUPLE: thread timeout continuation continued? ; : (mailbox-block-if-empty) ( mailbox timeout -- mailbox2 ) over mailbox-empty? [ [ swap mailbox-threads push stop ] callcc0 - "(mailbox-block-if-empty)" print flush (mailbox-block-if-empty) ] [ drop