Fix erg's bug

db4
Slava Pestov 2008-07-29 18:44:44 -05:00
parent 1bb4763927
commit e61ef195b6
2 changed files with 15 additions and 8 deletions

View File

@ -41,3 +41,5 @@ yield
] ; ] ;
[ t ] [ spawn-namespace-test ] unit-test [ t ] [ spawn-namespace-test ] unit-test
[ "a" [ 1 1 + ] spawn 100 sleep ] must-fail

View File

@ -4,16 +4,22 @@
USING: arrays hashtables heaps kernel kernel.private math USING: arrays hashtables heaps kernel kernel.private math
namespaces sequences vectors continuations continuations.private namespaces sequences vectors continuations continuations.private
dlists assocs system combinators init boxes accessors dlists assocs system combinators init boxes accessors
math.order dequeues ; math.order dequeues strings quotations ;
IN: threads IN: threads
SYMBOL: initial-thread SYMBOL: initial-thread
TUPLE: thread TUPLE: thread
name quot exit-handler { name string }
id { quot callable initial: [ ] }
continuation state runnable { exit-handler callable initial: [ ] }
mailbox variables sleep-entry ; { id integer }
continuation
state
runnable
mailbox
variables
sleep-entry ;
: self ( -- thread ) 63 getenv ; inline : self ( -- thread ) 63 getenv ; inline
@ -62,8 +68,7 @@ PRIVATE>
swap >>name swap >>name
swap >>quot swap >>quot
\ thread counter >>id \ thread counter >>id
<box> >>continuation <box> >>continuation ; inline
[ ] >>exit-handler ; inline
: <thread> ( quot name -- thread ) : <thread> ( quot name -- thread )
\ thread new-thread ; \ thread new-thread ;
@ -211,7 +216,7 @@ GENERIC: error-in-thread ( error thread -- )
<dlist> 65 setenv <dlist> 65 setenv
<min-heap> 66 setenv <min-heap> 66 setenv
initial-thread global initial-thread global
[ drop f "Initial" <thread> ] cache [ drop [ ] "Initial" <thread> ] cache
<box> >>continuation <box> >>continuation
t >>runnable t >>runnable
f >>state f >>state