-! Copyright (C) 2008, 2010 Slava Pestov.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: accessors assocs io io.styles kernel math.order\r
-math.parser prettyprint sequences sorting system threads ;\r
-IN: tools.threads\r
-\r
-: thread. ( thread -- )\r
- dup id>> pprint-cell\r
- dup name>> [\r
- over write-object\r
- ] with-cell\r
- dup state>> [\r
- [ dup self eq? "running" "yield" ? ] unless*\r
- write\r
- ] with-cell\r
- [\r
- sleep-entry>> [\r
- key>> nano-count [-] number>string write\r
- " nanos" write\r
- ] when*\r
- ] with-cell ;\r
-\r
-: threads. ( -- )\r
- standard-table-style [\r
- [\r
- { "ID:" "Name:" "Waiting on:" "Remaining sleep:" }\r
- [ [ write ] with-cell ] each\r
- ] with-row\r
-\r
- threads sort-keys values [\r
- [ thread. ] with-row\r
- ] each\r
- ] tabular-output nl ;\r
+! Copyright (C) 2008, 2010 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors assocs io io.styles kernel math.order
+math.parser prettyprint sequences sorting system threads ;
+IN: tools.threads
+
+: thread. ( thread -- )
+ dup id>> pprint-cell
+ dup name>> [
+ over write-object
+ ] with-cell
+ dup state>> [
+ [ dup self eq? "running" "yield" ? ] unless*
+ write
+ ] with-cell
+ [
+ sleep-entry>> [
+ key>> nano-count [-] number>string write
+ " nanos" write
+ ] when*
+ ] with-cell ;
+
+: threads. ( -- )
+ standard-table-style [
+ [
+ { "ID:" "Name:" "Waiting on:" "Remaining sleep:" }
+ [ [ write ] with-cell ] each
+ ] with-row
+
+ threads sort-keys values [
+ [ thread. ] with-row
+ ] each
+ ] tabular-output nl ;