1 ! Copyright (C) 2008 Slava Pestov.
\r
2 ! See http://factorcode.org/license.txt for BSD license.
\r
3 USING: threads kernel prettyprint prettyprint.config
\r
4 io io.styles sequences assocs namespaces sorting boxes
\r
5 heaps.private system math math.parser math.order accessors ;
\r
8 : thread. ( thread -- )
\r
10 dup name>> over [ write-object ] with-cell
\r
12 [ dup self eq? "running" "yield" ? ] unless*
\r
17 key>> micros [-] number>string write
\r
23 standard-table-style [
\r
25 { "ID:" "Name:" "Waiting on:" "Remaining sleep:" }
\r
26 [ [ write ] with-cell ] each
\r
29 threads >alist sort-keys values [
\r
30 [ thread. ] with-row
\r
32 ] tabular-output nl ;
\r