threads: better error messages

db4
Slava Pestov 2009-07-07 13:00:58 -05:00
parent 6737d2cdab
commit 516ce0c71d
1 changed files with 6 additions and 4 deletions

View File

@ -43,13 +43,15 @@ sleep-entry ;
: thread-registered? ( thread -- ? ) : thread-registered? ( thread -- ? )
id>> threads key? ; id>> threads key? ;
ERROR: already-stopped thread ;
: check-unregistered ( thread -- thread ) : check-unregistered ( thread -- thread )
dup thread-registered? dup thread-registered? [ already-stopped ] when ;
[ "Thread already stopped" throw ] when ;
ERROR: not-running thread ;
: check-registered ( thread -- thread ) : check-registered ( thread -- thread )
dup thread-registered? dup thread-registered? [ not-running ] unless ;
[ "Thread is not running" throw ] unless ;
<PRIVATE <PRIVATE