]> gitweb.factorcode.org Git - factor.git/blob - basis/debugger/threads/threads.factor
Switch to https urls
[factor.git] / basis / debugger / threads / threads.factor
1 ! Copyright (C) 2008, 2011 Slava Pestov.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: accessors debugger continuations threads io io.styles
4 prettyprint kernel make 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 ! ( error thread -- * )
16 [
17     dup initial-thread get-global eq? [
18         die drop rethrow
19     ] [
20         [
21             error-in-thread. nl
22             print-error nl
23             :c
24             flush
25         ] with-global
26         stop
27     ] if
28 ] thread-error-hook set-global