From 516ce0c71de7e5a8bd64a255b2f39d208a9353f7 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 7 Jul 2009 13:00:58 -0500 Subject: [PATCH] threads: better error messages --- basis/threads/threads.factor | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/basis/threads/threads.factor b/basis/threads/threads.factor index cacc628e2a..dec44625f7 100644 --- a/basis/threads/threads.factor +++ b/basis/threads/threads.factor @@ -43,13 +43,15 @@ sleep-entry ; : thread-registered? ( thread -- ? ) id>> threads key? ; +ERROR: already-stopped thread ; + : check-unregistered ( thread -- thread ) - dup thread-registered? - [ "Thread already stopped" throw ] when ; + dup thread-registered? [ already-stopped ] when ; + +ERROR: not-running thread ; : check-registered ( thread -- thread ) - dup thread-registered? - [ "Thread is not running" throw ] unless ; + dup thread-registered? [ not-running ] unless ;