]> gitweb.factorcode.org Git - factor.git/blob - basis/debugger/threads/threads.factor
7bb240859e8abf3d2c05e3859b7fe2cc63161479
[factor.git] / basis / debugger / threads / threads.factor
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors debugger continuations threads threads.private
4 io io.styles prettyprint kernel math.parser namespaces ;
5 IN: debugger.threads
6
7 : error-in-thread. ( thread -- )
8     "Error in thread " write
9     [
10         dup id>> #
11         " (" % dup name>> %
12         ", " % dup quot>> unparse-short % ")" %
13     ] "" make swap write-object ":" print ;
14
15 M: thread error-in-thread ( error thread -- )
16     initial-thread get-global eq? [
17         die drop
18     ] [
19         global [
20             error-thread get-global error-in-thread. nl
21             print-error nl
22             :c
23             flush
24         ] bind
25     ] if ;
26
27 [ self error-in-thread stop ]
28 thread-error-hook set-global