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
[ "a" [ 1 1 + ] spawn 100 sleep ] must-fail

View File

@ -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
<box> >>continuation
[ ] >>exit-handler ; inline
<box> >>continuation ; inline
: <thread> ( quot name -- thread )
\ thread new-thread ;
@ -211,7 +216,7 @@ GENERIC: error-in-thread ( error thread -- )
<dlist> 65 setenv
<min-heap> 66 setenv
initial-thread global
[ drop f "Initial" <thread> ] cache
[ drop [ ] "Initial" <thread> ] cache
<box> >>continuation
t >>runnable
f >>state