summaryrefslogtreecommitdiff
path: root/examples/pc.nl
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-06-14 14:50:38 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-06-14 19:31:39 -0400
commit797b22036e745df93aa73a78e2a0ed6698836b47 (patch)
treee22099819661f10ca5afc4975f08dcb253acd2f1 /examples/pc.nl
parent0e3b4a4c09cbf63cd6399f58e849c8a5f07fdcc0 (diff)
Prettier printing
Diffstat (limited to 'examples/pc.nl')
-rw-r--r--examples/pc.nl14
1 files changed, 6 insertions, 8 deletions
diff --git a/examples/pc.nl b/examples/pc.nl
index ba10f0b..5a1243a 100644
--- a/examples/pc.nl
+++ b/examples/pc.nl
@@ -67,7 +67,7 @@ thread_exit()
n_done: int32;
-t1()
+t1 ()
{
thread_fork (fn () { t2 ("t2:1"); });
@@ -79,25 +79,24 @@ t1()
thread_yield();
}
- print "t1 is done, forking some more t2s";
+ print "done: t1, forking some more t2s";
thread_fork (fn() { t2 ("t2:2"); });
thread_fork (fn() { t2 ("t2:3"); });
n_done++;
thread_exit();
}
-t2 (s: string)
+t2 (name: string)
{
for (i := 0; i < 7; ++i)
{
- print s;
+ print name, 12;
if (i % 2 == 0)
thread_yield();
}
- print s;
- print "is done";
+ print "done:", name;
n_done++;
thread_exit();
}
@@ -117,5 +116,4 @@ for (;;)
/* Once the last thread exits, it will go here */
@process_exit:
- print n_done;
- print "process done";
+ print n_done, "threads finished";