threads. now shows sleeping threads

db4
Slava Pestov 2008-02-21 19:13:11 -06:00
parent d47433a48d
commit 4ceb51ccbb
1 changed files with 10 additions and 3 deletions

View File

@ -2,17 +2,24 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
IN: tools.threads IN: tools.threads
USING: threads kernel prettyprint prettyprint.config USING: threads kernel prettyprint prettyprint.config
io io.styles sequences assocs namespaces sorting boxes ; io io.styles sequences assocs namespaces sorting boxes
heaps.private system math math.parser ;
: thread. ( thread -- ) : thread. ( thread -- )
dup thread-id pprint-cell dup thread-id pprint-cell
dup thread-name over [ write-object ] with-cell dup thread-name over [ write-object ] with-cell
thread-state "running" or [ write ] with-cell ; dup thread-state "running" or [ write ] with-cell
[
thread-sleep-entry [
entry-key millis [-] number>string write
" ms" write
] when*
] with-cell ;
: threads. ( -- ) : threads. ( -- )
standard-table-style [ standard-table-style [
[ [
{ "ID" "Name" "Waiting on" } { "ID" "Name" "Waiting on" "Remaining sleep" }
[ [ write ] with-cell ] each [ [ write ] with-cell ] each
] with-row ] with-row