From e61ef195b63dda659a8e73cc29d8da383664ecc2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 29 Jul 2008 18:44:44 -0500 Subject: [PATCH] Fix erg's bug --- basis/threads/threads-tests.factor | 2 ++ basis/threads/threads.factor | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/basis/threads/threads-tests.factor b/basis/threads/threads-tests.factor index 122b7f1d59..adac84338d 100755 --- a/basis/threads/threads-tests.factor +++ b/basis/threads/threads-tests.factor @@ -41,3 +41,5 @@ yield ] ; [ t ] [ spawn-namespace-test ] unit-test + +[ "a" [ 1 1 + ] spawn 100 sleep ] must-fail diff --git a/basis/threads/threads.factor b/basis/threads/threads.factor index 4b32f4519d..c406d0db12 100755 --- a/basis/threads/threads.factor +++ b/basis/threads/threads.factor @@ -4,16 +4,22 @@ USING: arrays hashtables heaps kernel kernel.private math namespaces sequences vectors continuations continuations.private dlists assocs system combinators init boxes accessors -math.order dequeues ; +math.order dequeues strings quotations ; IN: threads SYMBOL: initial-thread TUPLE: thread -name quot exit-handler -id -continuation state runnable -mailbox variables sleep-entry ; +{ name string } +{ quot callable initial: [ ] } +{ exit-handler callable initial: [ ] } +{ id integer } +continuation +state +runnable +mailbox +variables +sleep-entry ; : self ( -- thread ) 63 getenv ; inline @@ -62,8 +68,7 @@ PRIVATE> swap >>name swap >>quot \ thread counter >>id - >>continuation - [ ] >>exit-handler ; inline + >>continuation ; inline : ( quot name -- thread ) \ thread new-thread ; @@ -211,7 +216,7 @@ GENERIC: error-in-thread ( error thread -- ) 65 setenv 66 setenv initial-thread global - [ drop f "Initial" ] cache + [ drop [ ] "Initial" ] cache >>continuation t >>runnable f >>state